mirror of
https://github.com/ipfs/kubo.git
synced 2026-03-01 14:28:02 +08:00
Merge pull request #8931 from ipfs/ci/add-more-checks
ci: add more golang strictness checks
This commit is contained in:
commit
0d74f322df
37
.github/workflows/golang-analysis.yml
vendored
Normal file
37
.github/workflows/golang-analysis.yml
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
on: [push, pull_request]
|
||||
name: Go Checks
|
||||
|
||||
jobs:
|
||||
unit:
|
||||
runs-on: ubuntu-latest
|
||||
name: All
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
- uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: "1.17.x"
|
||||
- name: Check that go.mod is tidy
|
||||
uses: protocol/multiple-go-modules@v1.2
|
||||
with:
|
||||
run: |
|
||||
go mod tidy
|
||||
if [[ -n $(git ls-files --other --exclude-standard --directory -- go.sum) ]]; then
|
||||
echo "go.sum was added by go mod tidy"
|
||||
exit 1
|
||||
fi
|
||||
git diff --exit-code -- go.sum go.mod
|
||||
- name: gofmt
|
||||
if: always() # run this step even if the previous one failed
|
||||
run: |
|
||||
out=$(gofmt -s -l .)
|
||||
if [[ -n "$out" ]]; then
|
||||
echo $out | awk '{print "::error file=" $0 ",line=0,col=0::File is not gofmt-ed."}'
|
||||
exit 1
|
||||
fi
|
||||
- name: go vet
|
||||
if: always() # run this step even if the previous one failed
|
||||
uses: protocol/multiple-go-modules@v1.2
|
||||
with:
|
||||
run: go vet ./...
|
||||
@ -1,3 +1,4 @@
|
||||
//go:build linux
|
||||
// +build linux
|
||||
|
||||
package main
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
//go:build !linux
|
||||
// +build !linux
|
||||
|
||||
package main
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
//go:build testrunmain
|
||||
// +build testrunmain
|
||||
|
||||
package main
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
//go:build !wasm
|
||||
// +build !wasm
|
||||
|
||||
package util
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
//+build !windows
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package util
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
//go:build freebsd
|
||||
// +build freebsd
|
||||
|
||||
package util
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
//go:build !windows && !plan9
|
||||
// +build !windows,!plan9
|
||||
|
||||
package util
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
//go:build darwin || linux || netbsd || openbsd
|
||||
// +build darwin linux netbsd openbsd
|
||||
|
||||
package util
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
package util
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
//go:build !plan9
|
||||
// +build !plan9
|
||||
|
||||
package main
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
//go:build !windows && nofuse
|
||||
// +build !windows,nofuse
|
||||
|
||||
package commands
|
||||
|
||||
@ -21,11 +21,11 @@ var ErrNotOnline = errors.New("this command must be run in online mode. Try runn
|
||||
const (
|
||||
RepoDirOption = "repo-dir"
|
||||
ConfigFileOption = "config-file"
|
||||
ConfigOption = "config"
|
||||
DebugOption = "debug"
|
||||
LocalOption = "local" // DEPRECATED: use OfflineOption
|
||||
OfflineOption = "offline"
|
||||
ApiOption = "api"
|
||||
ConfigOption = "config"
|
||||
DebugOption = "debug"
|
||||
LocalOption = "local" // DEPRECATED: use OfflineOption
|
||||
OfflineOption = "offline"
|
||||
ApiOption = "api"
|
||||
)
|
||||
|
||||
var Root = &cmds.Command{
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
//go:build testrunmain
|
||||
// +build testrunmain
|
||||
|
||||
package main
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
//go:build !nofuse && !openbsd && !netbsd && !plan9
|
||||
// +build !nofuse,!openbsd,!netbsd,!plan9
|
||||
|
||||
package ipns
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
//go:build !nofuse && !openbsd && !netbsd && !plan9
|
||||
// +build !nofuse,!openbsd,!netbsd,!plan9
|
||||
|
||||
// package fuse/ipns implements a fuse filesystem that interfaces
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
//go:build !nofuse && !openbsd && !netbsd && !plan9
|
||||
// +build !nofuse,!openbsd,!netbsd,!plan9
|
||||
|
||||
package ipns
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
//go:build (linux || darwin || freebsd || netbsd || openbsd) && !nofuse
|
||||
// +build linux darwin freebsd netbsd openbsd
|
||||
// +build !nofuse
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
//go:build !nofuse && !windows && !openbsd && !netbsd && !plan9
|
||||
// +build !nofuse,!windows,!openbsd,!netbsd,!plan9
|
||||
|
||||
package mount
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
//go:build !nofuse
|
||||
// +build !nofuse
|
||||
|
||||
package node
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
//go:build !windows && nofuse
|
||||
// +build !windows,nofuse
|
||||
|
||||
package node
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
//go:build (!nofuse && openbsd) || (!nofuse && netbsd) || (!nofuse && plan9)
|
||||
// +build !nofuse,openbsd !nofuse,netbsd !nofuse,plan9
|
||||
|
||||
package node
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
//go:build !openbsd && !nofuse && !netbsd && !plan9
|
||||
// +build !openbsd,!nofuse,!netbsd,!plan9
|
||||
|
||||
package node
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
//go:build !windows && !openbsd && !netbsd && !plan9 && !nofuse
|
||||
// +build !windows,!openbsd,!netbsd,!plan9,!nofuse
|
||||
|
||||
package node
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
//go:build !nofuse && !openbsd && !netbsd && !plan9
|
||||
// +build !nofuse,!openbsd,!netbsd,!plan9
|
||||
|
||||
package readonly
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
//go:build (linux || darwin || freebsd) && !nofuse
|
||||
// +build linux darwin freebsd
|
||||
// +build !nofuse
|
||||
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
// +build !cgo,!noplugin
|
||||
//go:build !cgo && !noplugin && (linux || darwin || freebsd)
|
||||
// +build !cgo
|
||||
// +build !noplugin
|
||||
// +build linux darwin freebsd
|
||||
|
||||
package loader
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
//go:build noplugin
|
||||
// +build noplugin
|
||||
|
||||
package loader
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
// +build cgo,!noplugin
|
||||
//go:build cgo && !noplugin && (linux || darwin || freebsd)
|
||||
// +build cgo
|
||||
// +build !noplugin
|
||||
// +build linux darwin freebsd
|
||||
|
||||
package loader
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
//go:build tools
|
||||
// +build tools
|
||||
|
||||
package tools
|
||||
|
||||
Loading…
Reference in New Issue
Block a user