pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: shells/oh-my-posh



> What happens if a Go file has a _freebsd.go suffix but inside there is:
>
> // go:build freebsd || netbsd
>
> ?
> I get it that the _freebsd sufffix and go:build freebsd are redundant
> but I can't find information what is the order of evaluation of these
> build tags by go build. Would it build only on freebsd because of the
> file suffix or would it build also on netbsd disregarding the suffix?

The canonical documentation is
https://pkg.go.dev/cmd/go#hdr-Build_constraints as far as I know.

It says:

If a file's name, after stripping the extension and a possible _test
suffix, matches any of the following patterns:

*_GOOS
*_GOARCH
*_GOOS_GOARCH
(example: source_windows_amd64.go) where GOOS and GOARCH represent any
known operating system and architecture values respectively, then the
file is considered to have an implicit build constraint requiring
those terms (in addition to any explicit constraints in the file).

So in your case it would be "build on freebsd AND (freebsd or
netbsd)", which boils down to FreeBSD only. You would have to rename
the file.

-- 
Benny


Home | Main Index | Thread Index | Old Index