Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build no longer works on modern go #1

Open
bobpaul opened this issue Dec 5, 2024 · 1 comment
Open

Build no longer works on modern go #1

bobpaul opened this issue Dec 5, 2024 · 1 comment

Comments

@bobpaul
Copy link

bobpaul commented Dec 5, 2024

I had to specify the *.go file to use.

Problem

$ make
go: cannot find main module, but found .git/config in /home/bobpaul/puntar
	to create a module there, run:
	go mod init
go: cannot find main module, but found .git/config in /home/bobpaul/puntar
	to create a module there, run:
	go mod init
Building: 
go build -trimpath
go: cannot find main module, but found .git/config in /home/bobpaul/puntar
	to create a module there, run:
	go mod init
make: *** [Makefile:8: puntar] Error 1

$ go version
go version go1.23.2 linux/ppc64le

$ go list -f '{{.GoFiles}}'
go: cannot find main module, but found .git/config in /home/bobpaul/aur/puntar
	to create a module there, run:
	go mod init

Work Around

Specify the required files. So for linux, do:

$ go build -trimpath np_linux.go puntar.go

$ ./puntar -help
Usage of ./puntar:
  -dir string
    	destination directory (default ".")
  -file string
    	tar file to extract
  -update
    	update existing target
  -verbose
    	enable verbose logging
  -workers uint
    	number of concurrent workers (default 4)

I'm not familiar with the go build system, but I know from other projects that there's a "go" way to do this such that make isn't even needed.

@bobpaul
Copy link
Author

bobpaul commented Dec 5, 2024

Looks like this project builds unmodified with go v1.13 - v1.15. building in docker I suppose is an easy way to get an older version. <= v12 don't recognize -trimpath and >= v16 don't know which files to build.

$ docker run --rm -it --volume ./:/usr/src/app --workdir /usr/src/app golang:1.15 make
$ mv app puntar
$ puntar --help
Building: np_linux.go puntar.go
go build -trimpath
Usage of puntar:
  -dir string
    	destination directory (default ".")
  -file string
    	tar file to extract
  -update
    	update existing target
  -verbose
    	enable verbose logging
  -workers uint
    	number of concurrent workers (default 4)

Sadly, regardless which version of go I use to build it on both x64-64 and ppc64le it does not work. puntar -verbose -dir . -file file.tar exits immediately with no errors and nothing is extracted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant