Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This annoys me immensely. I understand a standardized format for installed packages, but I should be able to dictate the hierarchy of my own code....


If everyone dictated their own hierarchy for their code base, utilities like go build and go get wouldn't work.

The guidelines are just guidelines - you can still do whatever the hell you want, but don't expect the standard tools to automatically handle all your own personal preferences for project structure.

Go had has this structure ever since the Go 1 release - your source goes in $GOPATH/src/$YOUR_PATH, and the go get/build tool will compile any main packages to $GOPATH/cmd, and all packages to $GOPATH/pkg/$YOUR_PATH.

If you really want to isolate the code for a specific application/project, why not use a folder structure like $GOPATH/src/$PROJECT/$PACKAGE or $GOPATH/src/$PROJECT/$EXECUTABLE. I had problems initially adjusting to the Go 1 workspace changes, but it's really not a big issue once you adapt a little (like anything in Go).


$GOPATH is like $PATH in that it is a list of colon delimited directories, so it more like ${ANYNUMBEROFPLACES}/src/packages




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: