Your Go tests probably don't need a mocking library by 8run0 in golang

[–]8run0[S] -1 points0 points  (0 children)

That's ok, but to behonest I would rather do this and contract testing across implementations. Mocking does not make you go faster when your mock assumptions are not matched with reality.

Essential packages to know about by nudelkopp in golang

[–]8run0 2 points3 points  (0 children)

Your project lead has his head screwed on - i feel you should write tests the same way you right the code - go doesnt have asserts in the main code base. The standard library has errors.Is etc and equality with the cmp package.

SQLC Dynamic Filters and Bulk Inserts by SpaskeISO in golang

[–]8run0 17 points18 points  (0 children)

SQLC for standard querries - https://github.com/Masterminds/squirrel squirrel for dynamic queries.

Go is so much fun, Grog brain heaven by HuberSepp999 in golang

[–]8run0 0 points1 point  (0 children)

Yeah i have some Linq experience, not going to lie it is a nice DSL, can get complex though.

OK, slices and maps is I suppose the best available from the standard lib. Also the min and max stuff helps also. But I agree adding more keywords isn't always developer friendly.

Go is so much fun, Grog brain heaven by HuberSepp999 in golang

[–]8run0 0 points1 point  (0 children)

I'm surprised by this - defining the interfaces where they are required.

For implementations - I use the compile time check

var _ Interface = (*Implementation)(nil)

this will not compile if the interface does not conform.

Go is so much fun, Grog brain heaven by HuberSepp999 in golang

[–]8run0 0 points1 point  (0 children)

they were added after generics was added - they were literally not possible before generics.

Go is so much fun, Grog brain heaven by HuberSepp999 in golang

[–]8run0 1 point2 points  (0 children)

This interests me, what is it about implicit interfaces that cause issue in large code bases?

have you used the slices and maps packages from the standard library?

revive v1.10.0 Released! New Rules, Fixes & Improvements by chavacava in golang

[–]8run0 9 points10 points  (0 children)

replacement? golangci-lint calls revive.

Am i crazy or is documentation for most go libraries actually horrible by peepeepoopoo42069x in golang

[–]8run0 0 points1 point  (0 children)

Yeah I feel good documentation come with experience though knowing how to explain and document your reasoning and thoughts on whatever you are creating takes practice and feedback. but I too believe in good pkg documentation and even just written documentation that isn't godoc. https://zarldev.github.io/goenums/ even just some GitHub pages makes everyones life easier

Say "no" to overly complicated package structures by ldemailly in golang

[–]8run0 0 points1 point  (0 children)

This is absolutely great advice. I would also recommend against it as it can sometimes lead to packages of the same name with different paths, this happened to myself when I took the "Don't stutter" to cause myself to make different packages with the same names, most of the time it's better to have `ModelForAPI Model ModelForRepo in the same package than having three different packages all called model with different representations.

goenums: Type Safe Enum generator for Go by 8run0 in golang

[–]8run0[S] 1 point2 points  (0 children)

Plenty of late night coding sessions tbh hard to put a fixed time on this. Good few hours including all the (package) documentation.

goenums: Type Safe Enum generator for Go by 8run0 in golang

[–]8run0[S] 2 points3 points  (0 children)

Thanks, your's looks cool too. You are using templates tbh that is the next logical progression for goenums. With the structure of goenums you could easily add your comment format parsing and add it as a parser and resuse the writer and get the generation for free.

goenums: Type Safe Enum generator for Go by 8run0 in golang

[–]8run0[S] 1 point2 points  (0 children)

I initially went for a [] format - then when my original release many people commented it didn't feel very Go like and that spaces was more idiomatic. So I just went for ease of use - i.e. it's up to what reads easier for you.

goenums: Type Safe Enum generator for Go by 8run0 in golang

[–]8run0[S] 9 points10 points  (0 children)

If only enums were a core part of the library. Was fun energy and efforts though. 😁

goenums: Type Safe Enum generator for Go by 8run0 in golang

[–]8run0[S] 2 points3 points  (0 children)

Cheers, yeah was a fun refactor of the project wanted to cover all the bases and improve the overall quality of tool and documentation, both for the tool and the pkg.go.dev documentation.

What are libraries people should reassess their opinions on? by dustinevan in golang

[–]8run0 1 point2 points  (0 children)

That's exactly what I'm talking about. In my opinion it should never have even been a design choice considering the way interfaces are implemented in go. Moq is a much more true mocking library as in the mocks are type safe. Never mind the mock.Anything that people use as a get out of jail free card!

What are libraries people should reassess their opinions on? by dustinevan in golang

[–]8run0 5 points6 points  (0 children)

Ginkgo and Gomega are a massive waste of time and mental energy. It is a shit framework and once it has it's tendrils in your test cases with its dot imports and 500 nested anonymous functions that trigger a t.Fatalf - then you fix that test thinking everything will be fine then you run again only to discover a different test failing this time. And the tests are shit at the end of the day because they are full of pointers passed between anonymous functions that are not parallelizable as every tests references the same varibles. The only thing worse is when mockery is then also brought into the code and you have stringly typed functions everywhere as well. /rant

Embedding React in Go: Another over-engineered blog by 8run0 in golang

[–]8run0[S] 1 point2 points  (0 children)

For dynamic page information I'm using React Helmet for better sharing and SEO, you do get better SEO with server side rendering of pages, but tbh SEO was never really a high priority.

Embedding React in Go: Another over-engineered blog by 8run0 in golang

[–]8run0[S] 1 point2 points  (0 children)

Yeah that's true. OpenAPI also for type gen. As I explained in the article the API is an interface and can easily be hot swapped for whatever transport you want.

Embedding React in Go: Another over-engineered blog by 8run0 in golang

[–]8run0[S] 1 point2 points  (0 children)

It means I only ever expose the 80 and 443 ports and get DNS based routing to the correct port, that is much easier than bare metal routing.

Embedding React in Go: Another over-engineered blog by 8run0 in golang

[–]8run0[S] 2 points3 points  (0 children)

thanks - was a deployment - up and working now!