Re: [go-nuts] Permissions in ~/go/pkg

2024-05-10 Thread Ian Lance Taylor
On Fri, May 10, 2024 at 2:11 PM Tobias Klausmann wrote: > > On Fri, 10 May 2024, Ian Lance Taylor wrote: > > This is a choice made by Go. You can override with the -modcacherw > > option to "go build", "go test", "go install", and similar code. You > > can make that option the default by

[go-nuts] Re: var errors stdlib

2024-05-10 Thread 'Brian Candler' via golang-nuts
On Friday 10 May 2024 at 17:03:46 UTC+1 Sebastian Bogan wrote: Would something like the following work (and be less risky)?: type ConstError string func (e ConstError) Error() string { return string(e) } const ErrNotExist = ConstError("file does not exist") If you compare an error

Re: [go-nuts] Permissions in ~/go/pkg

2024-05-10 Thread Tobias Klausmann
Hi! On Fri, 10 May 2024, Ian Lance Taylor wrote: > This is a choice made by Go. You can override with the -modcacherw > option to "go build", "go test", "go install", and similar code. You > can make that option the default by setting GOFLAGS in the environment > or via "go env GOFLAGS=...". >

Re: [go-nuts] Permissions in ~/go/pkg

2024-05-10 Thread Ian Lance Taylor
On Fri, May 10, 2024 at 10:43 AM Tobias Klausmann wrote: > > I test and try a whole load of Go tools and libraries, and as a result, > my ~go/pkg dir quickly grows. While I'd love some kind of automatic > expiry for that cache, I am fine with just occasionally running rm-rf on > that dir myself.

Re: [go-nuts] var errors stdlib

2024-05-10 Thread 'Dan Kortschak' via golang-nuts
On Fri, 2024-05-10 at 04:24 -0700, Sebastian Bogan wrote: > Hello Everyone, > > I was wondering, what was / is the reason for exposing errors as > public vars - rather than constants? Doesn't that impose some risk? > > For example: > >   fs.ErrNotExist = errors.New("foo") >   _, err =

[go-nuts] VCS Stamping - How To Use It? How to debug failures?

2024-05-10 Thread Adam Kaplan (He / Him / His)
My team recently started using podman and the UBI9 go-toolset image to containerize our golang apps [1]. We found that if our Dockerfile copied the entire source tree in (including the .git directory), `go build` would fail unless we set the `-buildvcs=false` flag [2]. Since this wasn't

[go-nuts] Permissions in ~/go/pkg

2024-05-10 Thread Tobias Klausmann
Hi! I test and try a whole load of Go tools and libraries, and as a result, my ~go/pkg dir quickly grows. While I'd love some kind of automatic expiry for that cache, I am fine with just occasionally running rm-rf on that dir myself. ... except it doesn't work. For some unclear reason, some of

[go-nuts] var errors stdlib

2024-05-10 Thread Sebastian Bogan
Hello Everyone, I was wondering, what was / is the reason for exposing errors as public vars - rather than constants? Doesn't that impose some risk? For example: fs.ErrNotExist = errors.New("foo") _, err = os.ReadFile("./invalid") if !errors.Is(err, fs.ErrNotExist) { fmt.Println("is