Use GitHub actions to run golang-ci-lint, cross, and test.
The "Test()" target in Mage was a plain "go test -v ./...", and should be
portable to other CI systems if needed; running it through the mage file
effectively resulted in "compile a go binary to run go".
The "Lint()" target in Mage relied on Travis CI setting up Golang-CI lint
before it was executed, which required bash. Moving it to GitHub actions
also allowed it to be run on Windows. Golang CI can still be run locally
either through the mage file (which is kept for now), or running
`golangci-lint run ./...` after installing golangci-lint.
The "CrossBuild() Mage target is still used to perform cross-compile, as it
contains code to generate the GOOS/GOARCH matrix, which makes it easier
to run locally.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This should hopefully fix cross-compile on openbsd/mips64 on Go 1.16
Building for GOOS=openbsd GOARCH=mips64
# golang.org/x/sys/unix
Error: ../../../go/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/fcntl.go:26:42: undefined: Flock_t
Error: ../../../go/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/ioctl.go:26:47: undefined: Winsize
Error: ../../../go/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/ioctl.go:37:47: undefined: Termios
Error: ../../../go/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/ioctl.go:55:42: undefined: Winsize
Error: ../../../go/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/ioctl.go:61:42: undefined: Termios
Error: ../../../go/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/syscall_openbsd.go:34:6: missing function body
Error: ../../../go/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/syscall_unix_gc.go:12:6: missing function body
Error: ../../../go/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/syscall_unix_gc.go:13:6: missing function body
Error: ../../../go/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/syscall_unix_gc.go:14:6: missing function body
Error: ../../../go/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/syscall_unix_gc.go:15:6: missing function body
Error: ../../../go/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/ioctl.go:61:42: too many errors
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Move the magefile related files to a submodule, so that it
does not become a dependency for logrus itself.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Before this:
$ go run mage.go lint
Error: running "/Users/sebastiaan/go/bin/golangci-lint run ./..." failed with exit code 1
exit status 1
$ go run mage.go test
Error: running "go test -race -v ./..." failed with exit code 1
exit status 1
After this:
$ go run mage.go -v lint
Running target: Lint
exec: /Users/sebastiaan/go/bin/golangci-lint run ./...
entry.go:89:6: `iamNotUsed` is unused (deadcode)
func iamNotUsed() {
^
Error: running "/Users/sebastiaan/go/bin/golangci-lint run ./..." failed with exit code 1
exit status 1
$ go run mage.go -v test
Running target: Test
exec: go test -race -v ./...
=== RUN TestRegister
...
? github.com/sirupsen/logrus/internal/testutils [no test files]
FAIL
Error: running "go test -race -v ./..." failed with exit code 1
exit status 1
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
[Entry.log itself panics][0] when the log level is set to PanicLevel, (and
PanicLevel is always eneabled) so this second panic will never be reached.
[0]: 8ae478eb8a/entry.go (L253)
Instead of relying on EnableVirtualTerminalProcessing from
github.com/konsorten/go-windows-terminal-sequences which just calls
GetConsoleMode, sets ENABLE_VIRTUAL_TERMINAL_PROCESSING and calls
SetConsoleMode with the new modified mode, implement it directly inside
checkIfTerminal. This also avoids the duplicate call to GetConsoleMode.