From fd6c0aa81a9042cc03701b8c1c39720ba02beab6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20R=C3=BCger?= Date: Sat, 26 Mar 2022 00:26:41 +0100 Subject: [PATCH 1/2] Makefile: Move to golangci-lint --- Makefile | 15 +++------------ db_test.go | 4 ++-- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 21ecf48..1623c84 100644 --- a/Makefile +++ b/Makefile @@ -10,17 +10,8 @@ race: fmt: !(gofmt -l -s -d $(shell find . -name \*.go) | grep '[a-z]') -# go get honnef.co/go/tools/simple -gosimple: - gosimple ./... - -# go get honnef.co/go/tools/unused -unused: - unused ./... - -# go get github.com/kisielk/errcheck -errcheck: - @errcheck -ignorepkg=bytes -ignore=os:Remove go.etcd.io/bbolt +lint: + golangci-lint run ./... test: TEST_FREELIST_TYPE=hashmap go test -timeout 20m -v -coverprofile cover.out -covermode atomic @@ -33,4 +24,4 @@ test: # Note: gets "program not an importable package" in out of path builds @TEST_FREELIST_TYPE=array go test -v ./cmd/bbolt -.PHONY: race fmt errcheck test gosimple unused +.PHONY: race fmt test lint diff --git a/db_test.go b/db_test.go index f6f7de2..a512a01 100644 --- a/db_test.go +++ b/db_test.go @@ -30,7 +30,7 @@ const pageHeaderSize = 16 // meta represents a simplified version of a database meta page for testing. type meta struct { - magic uint32 + _ uint32 version uint32 _ uint32 _ uint32 @@ -38,7 +38,7 @@ type meta struct { _ uint64 pgid uint64 _ uint64 - checksum uint64 + _ uint64 } // Ensure that a database can be opened without error. From ff70d213eb059a2ab0204fa21e91a3c9c11478fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20R=C3=BCger?= Date: Sat, 26 Mar 2022 00:26:28 +0100 Subject: [PATCH 2/2] .github: Move from travis to github actions --- .github/workflows/tests.yaml | 16 ++++++++++++++++ .travis.yml | 18 ------------------ 2 files changed, 16 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/tests.yaml delete mode 100644 .travis.yml diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml new file mode 100644 index 0000000..a142f30 --- /dev/null +++ b/.github/workflows/tests.yaml @@ -0,0 +1,16 @@ +name: Tests +on: [push, pull_request] +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + go-version: "1.17.8" + - run: make fmt + - run: make race + - run: make test + # Enable when fixed (same as make lint) + # - name: golangci-lint + # uses: golangci/golangci-lint-action@v2 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 452601e..0000000 --- a/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -language: go -go_import_path: go.etcd.io/bbolt - -sudo: false - -go: -- 1.15 - -before_install: -- go get -v golang.org/x/sys/unix -- go get -v honnef.co/go/tools/... -- go get -v github.com/kisielk/errcheck - -script: -- make fmt -- make test -- make race -# - make errcheck