Skip to content

Commit

Permalink
build(storage): format code with go generate
Browse files Browse the repository at this point in the history
Signed-off-by: slasher <[email protected]>
  • Loading branch information
sejust committed Sep 18, 2023
1 parent b6824c0 commit a679018
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
12 changes: 10 additions & 2 deletions docker/script/run_format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@ CurrentPath=$(cd $(dirname ${BASH_SOURCE[0]}); pwd)
pushd ${CurrentPath}/../../
find . -type f -name "*.go" | grep -v 'vendor' |grep -v 'depends'| xargs gofmt -l > gofmt_results.txt
cat gofmt_results.txt
if [ "$(cat gofmt_results.txt|wc -l)" -gt 0 ]; then
if [ "$(cat gofmt_results.txt|wc -l)" -gt 0 ]; then
popd
exit 1;
exit 1;
fi
popd

pushd ${CurrentPath}/../../storage
export PATH=$PATH:/go/bin
go generate ./...
if [[ $? -ne 0 ]]; then
exit 1
fi
popd
6 changes: 6 additions & 0 deletions storage/extent_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ import (
"github.com/cubefs/cubefs/util/log"
)

//TODO: remove this later.
//go:generate go vet ./...
//go:generate gofumpt -l -w .
//go:generate git diff --exit-code
//go:generate golangci-lint run --issues-exit-code=1 -D errcheck -E bodyclose ./...

const (
ExtCrcHeaderFileName = "EXTENT_CRC"
ExtBaseExtentIDFileName = "EXTENT_META"
Expand Down

0 comments on commit a679018

Please sign in to comment.