Change all struct fields representing GitHub database IDs from int to
int64 to match the API spec and prevent potential overflow on 32-bit
architectures.
Add a custom go/analysis linter (idtype-checker) that flags struct
fields with ID-like names or JSON tags using int instead of int64,
integrated into make lint.
Closes#9247
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This fixes the taget name by adding .exe extension for Windows platform.
Otherwise, the following error is shown with `make bin/gh.exe' command.
make: *** No rule to make target 'script/build', needed by 'bin/gh.exe'. Stop.
`install` command on macOS does not support all flags supported by coreutils version.
Create directories as separate `install -d` call.
Signed-off-by: Aleksei Khudiakov <aleksey@xerkus.pro>
The main build script for this project is `script/build.go` which
implements Makefile-like building of the `gh` binary and associated man
pages. Our Makefile defers to the Go script.
However, when setting GOOS, GOARCH, and other environment variables to
modify the target for the resulting binary, these environment variables
would affect the execution of `build.go` as well, which was unintended.
This tweaks our Makefile to reset variables like GOOS and GOARCH when
building the `build.go` script itself, ensuring that the built script
runs on the same platform, and adds the ability to pass environment
variables as arguments to `go run script/build.go`. This allows the
following usage on platforms without `make`:
go run script/build.go GOOS=linux
With this style of invocation, the GOOS setting does not actually affect
`go run` itself; just the `go build` that is executed in a child process.
The implementation imitates the behavior of build-systems generated by
GNU Automake.
Implemented targets:
- install
- install-strip
- uninstall
Implemented variables:
- DESTDIR
- prefix
- bindir
- INSTALL_STRIP_FLAG
Internal implementation details:
- install-bins variable collects user binaries to be installed
- install-dirs variable collects directories to be created
- deb and rpm packages are now built for prereleases
- consolidate setup for deb & rpm
- man pages are generated for prereleases
- the `cli.github.com` site is only pushed to on full releases
Bonus:
- only publish the GitHub release after the Windows MSI is uploaded
- hub does not need downloading
Do not pass LDFLAGS as arguments to -ldflags, since these are passed to
'go tool link' and C compiler ldflags need to be passed as
-ldflags "-extldflags \"$LDFLAGS\"" with unreliable handling. Instead
copy over (unmodified) the standard environment variable to the special
golang-specific variable which the go compiler chooses to respect.
While we are at it, handle CPPFLAGS and CFLAGS too.