#28 golist fails when new go-1.17 `//go:build` style is used
Closed: Fixed 2 years ago by mikelo2. Opened 3 years ago by mikelo2.

golist fails when golang-1.17 new //go:build style is used:

$ go2rpm https://github.com/google/log4jscanner
//go:build comment without // +build comment
Traceback (most recent call last):
  File "/usr/bin/go2rpm", line 8, in <module>
    sys.exit(main())
  File "/usr/lib/python3.10/site-packages/go2rpm/__main__.py", line 598, in main
    buildrequires = to_list(get_buildrequires(forge, subdir))
  File "/usr/lib/python3.10/site-packages/go2rpm/__main__.py", line 442, in get_buildrequires
    buildrequires = subprocess.check_output(
  File "/usr/lib64/python3.10/subprocess.py", line 420, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib64/python3.10/subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['golist', '--imported', '--skip-self', '--package-path', 'github.com/google/log4jscanner']' returned non-zero exit status 1.

From go-1.17 release notes:

The go command now understands //go:build lines and prefers them over // +build lines. The new syntax uses boolean expressions, just like Go, and should be less error-prone. As of this release, the new syntax is fully supported, and all Go files should be updated to have both forms with the same meaning. To aid in migration, gofmt now automatically synchronizes the two forms. For more details on the syntax and migration plan, see https://golang.org/design/draft-gobuild.


Metadata Update from @mikelo2:
- Issue close_status updated to: Fixed
- Issue status updated to: Closed (was: Open)

2 years ago

Metadata Update from @mikelo2:
- Issue status updated to: Open (was: Closed)

2 years ago

Metadata Update from @mikelo2:
- Issue close_status updated to: Fixed
- Issue status updated to: Closed (was: Open)

2 years ago

Log in to comment on this ticket.

Metadata