On Thursday, June 3, 2021 at 6:04:21 PM UTC+2 Jacob Vosmaer wrote: > Hi, > > In our organization we have a main code repository that contains > components written in different programming languages. One of these > components is written in Go. I would like to be able to have a single > go.mod file for the whole repository, in the root directory. This doesn't > work smoothly as of Go 1.16 because we have a /vendor directory in this > repository, which has nothing to do with our Go code. > > Because /vendor exists, commands like 'go build' and 'go test' complain > about the vendor directory being out of sync. I am aware that there are > workarounds with command line flags (such as -mod=mod) and that one can > avoid typing these over and over by setting GOFLAGS. > > However, this makes for a poor developer experience because every new > contributor has to run in this problem locally and then modify their local > development environment. It would be much more ergonomic if there was a way > to tell the go toolchain to ignore /vendor based on a file in the > repository. Because then everybody who clones the repository and tries to > run 'go test' or 'go build' gets the correct default behavior. > > I could have sworn I found an issue about this a while ago but I can't > find it anymore, and I also don't see this topic in the golang-nuts > archive. > > Is there another workaround I'm overlooking? Should I open an issue for > this? > > One possible solution is to have a GOENV file in the root directory of a repository. This similar to git where, by default, the config file is first read from .git/config, then from ~/.gitconfig and finally from /etc/gitconfig.
The problem is how to handle a write to GOENV; probably the local env file should be ignored. Regards Manlio -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/f90be255-d94e-49d9-ad26-6477bfcc60b2n%40googlegroups.com.