I installed go 1.22.6 from archive for linux_amd64, unzipped, added go to PATH and re-ran the ~/.bashrc.
Then I also copied the same version into /opt/go1.22 for running make.bash by setting GOROOT_BOOTSTRAP to this /opt/go1.22.
And created a small hello.go program which imports “fmt” and tried to compile it using
go tool compile -o hello hello.go
But then I got the error package not found “fmt”.
I checked for archive files in /usr/local/go/pkg/linux_amd64 but there not linux_amd64 directory in /pkg
I am not sure why it is not generating.
Any insights / solutions would really help.
Thank you.
vxtls
(VXTLS)
June 1, 2025, 12:55am
3
but, why you use go tool instead of go build?
lemarkar
(Leo Emar-Kar)
June 7, 2025, 8:37am
5
Hello there, I guess this discussion is related and can explain that it’s the way it suppose to work
2 Likes
You can use go build -x -work hello.go &> build.log to see the actual command invoked by go, the compiler driver. There are many packages your package depends on, fmt for example, to be compiled by compile tool before compiling hello.go. Moreover, you can add -a option to force rebuild and avoid cache of building.
system
(system)
Closed
October 9, 2025, 10:44am
7
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.