DEV Community

Discussion on: My reflections on Golang

Collapse
 
biros profile image
Boris Jamot ✊ /

I agree about the dependency management but it's been quite a year since go mod birth. Today you can put your code wherever you want (outside of GOPATH) and have basic dependency management features like adding a new dependency, update an existing dependency, etc.

I agree that there is a lot of boilerplate code but it's not a problem for me as it helps to understand what the code does and IDEs have snippet features to quickly write this kind of code.

I develop in Go since 9 months also and what was confusing for me is the lack of conventional project structure. I started with my good old MVC layer structure and ended up with a more pragmatic structure inspired from golang-standards/project-layout.

Another pain in the ass is the lack of reflection in unit tests mocking libraries. Unlike mockito or phpunit, you have to use tools like testify or mockgen to generate mocks that you can use in your UT. It's a lot of extra work compared to PHP and Java.

But in the end, I still love Go :)

Collapse
 
deepu105 profile image
Deepu K Sasidharan

I thought putting projects in Go path is still the official recommendation. At least the website says so golang.org/doc/code.html

Could you point me to doc or an article explaining how to do it outside of GOPATH? I'm defineley interested sop that I can get rid of my current workarounds.

Collapse
 
biros profile image
Boris Jamot ✊ /

It must be in the official go mod doc on the wiki. I'll put the link when I'll be back to my desktop.

Thread Thread
 
jma profile image
Jie

you can put code in anywhere once using go module
github.com/golang/go/wiki/Modules