Hi

I think it's a time to close it for now.

<https://golang.org/src/cmd/go/pkg.go#L1111> leads to 404
--8<---------------cut here---------------start------------->8---
to, err := human()
open src/cmd/go/pkg.go: file does not exist
--8<---------------cut here---------------end--------------->8---

This just lists internal modules coming with go source, and no go-*
packages are used during the build:
--8<---------------cut here---------------start------------->8---
go list -f '{{join .Deps "\n"}}' cmd/go
--8<---------------cut here---------------end--------------->8---

The attempt to find out the purpose of 'pkg/' leads me to a deep search
kung-fu with a few information in official Documentation.
- 
https://stackoverflow.com/questions/47369621/what-is-the-use-of-pkg-directory-in-go
- https://go.dev/doc/code#Workspaces

I would not treat this statement as something relevant to go@1.19+ (we
have 1.21 as a default for build):
- https://github.com/golang-standards/project-layout?tab=readme-ov-file#pkg
--8<---------------cut here---------------start------------->8---
Library code that's ok to use by external applications (e.g.,
/pkg/mypubliclib). Other projects will import these libraries expecting
them to work, so think twice before you put something here :-) Note that
the internal directory is a better way to ensure your private packages
are not importable because it's enforced by Go. The /pkg directory is
still a good way to explicitly communicate that the code in that
directory is safe for use by others.
--8<---------------cut here---------------end--------------->8---

I'm not sure that anyone uses Guix in Golang development and dependency
management, while go-build-system is heavily tweaked to produce just final
output for the user's command binary.

I'm also not sure if it's by design or it's a bug, if it's by disign "go
env" does not provide any relevant environment variable which may be
tweaked like we did for others in go-build-system:
--8<---------------cut here---------------start------------->8---
guix shell -D go -- bash -c 'export t=$(mktemp -d); cd $t && export 
GOPATH=$(pwd) GOBIN=$(pwd)/bin && go install cmd/go'
<...>
cmd/go: go install cmd/go: copying /tmp/go-build7392385/b001/exe/a.out: open 
/gnu/store/ah4ni8qjiffgw2100hl4bqffgydi7jkv-go-1.21.13/lib/go/bin/go: read-only 
file system
--8<---------------cut here---------------end--------------->8---

But... I can do this, which ignores all the packages availalbe in
/gnu/store and just downloads everything from Inherent then builds with
success:
--8<---------------cut here---------------start------------->8---
guix shell -D go kubo -- bash -c 'export t=$(mktemp -d); cd $t && export 
GOPATH=$(pwd) GOBIN=$(pwd)/bin && go install 
github.com/ipfs/kubo/cmd/ipfs@latest; pwd; ls $t'
<...>
/tmp/tmp.HB3jKQBvco
bin  pkg
/tmp/tmp.HB3jKQBvco/bin/ipfs --version
ipfs version 0.33.0
--8<---------------cut here---------------end--------------->8---

It's a good opportunity for GCD ;-) where we may discus how to tweak
go-build-system even more to utilize available go-* packages from the
store during development.
<https://issues.guix.gnu.org/74736>

Based on above the issue is closed. 

--
Oleg

Attachment: signature.asc
Description: PGP signature

Reply via email to