[go-nuts] Re: accessibility of module version information in executable

2020-06-26 Thread seank...@gmail.com
go version -m $binary runtime/debug.BuildInfo On Friday, June 26, 2020 at 6:13:56 PM UTC+2 Marvin Renich wrote: > When building a command with go build that imports modules, does the > resulting executable contain information about which modules are > included as well as their versions? > > If s

[go-nuts] Re: Building multiple executables from one module

2020-06-30 Thread seank...@gmail.com
go build -o output_directory ./... On Tuesday, June 30, 2020 at 12:58:05 PM UTC+2 b.ca...@pobox.com wrote: > Suppose I have a tree of files like this, to build two executables: > > ==> ./go.mod <== > module example.com/test > > go 1.14 > > ==> ./shared.go <== > package example > > const Answer =

[go-nuts] Re: clean unused packages in $GOPATH/pkg/mod

2020-07-07 Thread seank...@gmail.com
go clean -modcache On Tuesday, July 7, 2020 at 9:23:50 AM UTC+2 HailangGe wrote: > > Thanks. I'm just trying to look for if there are any way to clean them in > a programmer's way. > 在2020年7月7日星期二 UTC+8 下午1:26:16 写道: > >> Just delete them all. >> Your next build will repopulate the ones that are

Re: [go-nuts] var fn myHandler = func(){ fn }

2020-07-12 Thread seank...@gmail.com
https://github.com/golang/go/issues/33167 On Sunday, July 12, 2020 at 10:44:02 PM UTC+2 axel.wa...@googlemail.com wrote: > On Sun, Jul 12, 2020 at 9:33 PM Bakul Shah wrote: > >> On Jul 12, 2020, at 11:11 AM, Gert wrote: >> > >> > https://play.golang.org/p/6xMgjr1IyFD >> > >> > var fn myHandl

[go-nuts] Re: best way to know executable version without running it

2020-08-13 Thread seank...@gmail.com
go version -m On Thursday, August 13, 2020 at 10:30:56 AM UTC+2 santhoshth...@gmail.com wrote: > Hi All, > > What is best way to know a executable version without executing it through > golang? > > I tried with reading the executable file through a scanner and matching > every line with regex

[go-nuts] Re: The latest version of package in pkg.go.dev

2020-08-15 Thread seank...@gmail.com
that's an invalid semver, no leading 0s allowed https://semver.org/#spec-item-2 : A normal version number MUST take the form X.Y.Z where X, Y, and Z are non-negative integers, and MUST NOT contain leading zeroes. X is the major version, Y is the minor version, and Z is the patch version. Each e

[go-nuts] Re: Generating code into module cache?

2020-10-20 Thread seank...@gmail.com
That doesn't really make sense? The module cache is for immutable versions of modules, ie. publish your (generated) code as a package/module, import that it will then get cached On Tuesday, October 20, 2020 at 8:50:25 PM UTC+2 mattm...@gmail.com wrote: > Hey folks, > > I'm working on a project

Re: [go-nuts] Table driven tests and error/output testing

2020-10-20 Thread seank...@gmail.com
you should be able to unconditionally compare the output without doing the length check On Tuesday, October 20, 2020 at 8:51:56 AM UTC+2 amits...@gmail.com wrote: > > On 20 Oct 2020, at 4:13 pm, Tamás Gulácsi wrote: > > Use bytes.Buffer or strings.Builder directly - no need for the > bufio.Wri

Re: [go-nuts] Running "go test" modifies go.mod & go.sum

2020-11-01 Thread seank...@gmail.com
you're using the analysis packages which have dependencies on calling the go cmd internally you could try passing readonly via GOFLAGS the fact that your go.mod/go.sum changed means you should reevaluate what you're doing, specifically you have an unversioned/untracked dependency on gorilla/mux

[go-nuts] Re: Go modules replace statements referencing legacy codebases

2020-11-06 Thread seank...@gmail.com
I think you should be able to do `go get ./... dep1@branchA dep2@branchB ...` On Friday, November 6, 2020 at 3:20:16 PM UTC+1 Jim Minter wrote: > Hi, > > Using Go 1.14, I'm working on a parent codebase which, in its go.mod > file, has a number of replace statements referencing legacy child > co

[go-nuts] Re: go get not downloading a module under a repository from BitBucket

2020-11-08 Thread seank...@gmail.com
https://golang.org/ref/mod#vcs-version 3rd paragraph > If a module is defined in a subdirectory within the repository, that is, the module subdirectory portion of the module path is not empty, then each tag name must be prefixed with the mod

[go-nuts] Re: My app hangs up at some point in net/http/h2_bundle.go. What is the better way to debug?

2020-11-09 Thread seank...@gmail.com
maybe setting GODEBUG=http2debug=2 to spit out some logs? On Monday, November 9, 2020 at 5:49:57 PM UTC+1 telyuk...@gmail.com wrote: > Hello! > > I use third-party software with my own code to build reverse-proxy, which > supports http/2. Sometimes requests hang up with infinite waiting. With >

[go-nuts] Re: use same for/range code on a hash map but it has different result

2020-11-10 Thread seank...@gmail.com
spec: https://golang.org/ref/spec#RangeClause point 3: ... If a map entry is created during iteration, that entry may be produced during the iteration or may be skipped. The choice may vary for each entry created and from one iteration to the next. ... On Tuesday, November 10, 2020 at 3:12:54 P

[go-nuts] Re: Not getting 1.15.5 as the latest Go version - getgo

2020-11-17 Thread seank...@gmail.com
VERSION reports the version the site is under, use https://golang.org/dl/?mode=json instead On Tuesday, November 17, 2020 at 5:21:43 PM UTC+1 fmpw...@gmail.com wrote: > Hi, > > Today I tried the getgo [1] binary but instead of providing Go 1.15.5, it > installed 1.15.4. I looked around the code

[go-nuts] Re: Any recommendation for structured logging library in Golang?

2020-11-18 Thread seank...@gmail.com
Since you've been using glog, k8s.io/klog/v2 (fork by kubernetes) should feel familiar and v2 supports the structured variants On Wednesday, November 18, 2020 at 5:21:48 AM UTC+1 ChrisLu wrote: > I am considering moving from glog to structured logging. I tried logrus, > go-kit, uber/zap, but co

Re: [go-nuts] How to plug git version when using "go get" to fetch a cli?

2020-11-25 Thread seank...@gmail.com
using `runtime/debug` this will return a tagged or pseudo version when retrieved through `go get` in module mode, in other cases it will return `(devel)` i, _ := debug.ReadBuildInfo() fmt.Println(i.Main.Version) On Wednesday, November 25, 2020 at 7:14:45 PM UTC+1 changkun wrote: > That is real

[go-nuts] error handling proposals summary

2020-11-25 Thread seank...@gmail.com
For some reason I thought going through most of the error handling proposals would be a nice way to spend the evening (note I now mostly regret this). If anyone wants to see how similar they are: https://seankhliao.com/blog/12020-11-23-go-error-handling-proposals/ -- You received this message

[go-nuts] Re: [error handling] RFC 'else'

2020-12-02 Thread seank...@gmail.com
see also https://github.com/golang/go/issues/41908 https://github.com/golang/go/issues/37243 https://github.com/gooid/gonotes/blob/master/inline_style_error_handle.md On Wednesday, December 2, 2020 at 8:57:13 PM UTC+1 Oliver Smith wrote: > Do I understand correctly that "last return value is err