Skip to content

Commit

Permalink
rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-carlton committed Jan 16, 2024
1 parent 809ffd5 commit 7d201ff
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 21 deletions.
4 changes: 2 additions & 2 deletions bin/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if [ ! -d "$package_name" ] ; then
fi
TOP=`git rev-parse --show-toplevel`
make -C $TOP/$package_name --makefile=$TOP/makefile.mk gofmt
make -C $TOP/$package_name --makefile=$TOP/makefile.mk gofumpt
make -C $TOP/$package_name --makefile=$TOP/makefile.mk goimports
# make -C $TOP/$package_name --makefile=$TOP/makefile.mk gofumpt
# make -C $TOP/$package_name --makefile=$TOP/makefile.mk goimports
make -C $TOP/$package_name --makefile=$TOP/makefile.mk clean
make -C $TOP/$package_name --makefile=$TOP/makefile.mk
13 changes: 4 additions & 9 deletions golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ linters-settings:
gocyclo:
# minimal code complexity to report, 30 by default (but we recommend 10-20)
min-complexity: 10
maligned:
fieldalignment:
# print struct with more effective memory layout or not, false by default
suggest-new: true
dupl:
Expand Down Expand Up @@ -177,8 +177,7 @@ linters:
enable:
- asciicheck
- bodyclose
- deadcode
- depguard
# - depguard
- dogsled
- dupl
- exhaustive
Expand All @@ -199,31 +198,27 @@ linters:
- gofumpt
- goheader
- goimports
- golint
- revive
- gomnd
- gomodguard
- goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
- interfacer
- lll
- maligned
- misspell
- nakedret
- nestif
- staticcheck
- structcheck
- typecheck
- unused
- varcheck
- noctx
- nolintlint
- nlreturn
- prealloc
- rowserrcheck
- scopelint
- exportloopref
- sqlclosecheck
- stylecheck
- testpackage
Expand Down
7 changes: 2 additions & 5 deletions makefile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,15 @@ lint: ${LINT_ARTIFACT}
${LINT_ARTIFACT}: ${MAKEFILE_PATH}/golangci-lint.yml ${GO_SOURCES}
echo "${YELLOW}Running go lint${NC_DIR}" && \
(cd $(CURDIR) && \
procs=$$(expr $$( \
(grep -c ^processor /proc/cpuinfo || \
sysctl -n hw.ncpu || \
echo 1) 2>/dev/null) '*' 2 '-' 1) && \
procs=$$(expr $$(4 '*' 2 '-' 1)) && \
GOPROXY=https://proxy.golang.org,direct \
golangci-lint run \
--config ${MAKEFILE_PATH}/golangci-lint.yml \
--concurrency=$${procs} \
--path-prefix "$$(realpath --relative-to ${MAKEFILE_PATH} ${CURDIR})/." \
.) && \
touch $@ && \
cd ${MAKEFILE_PATH}
cd ${MAKEFILE_PATH} && \

go.mod:
go mod tidy
Expand Down
4 changes: 2 additions & 2 deletions pkg/testutils/test-framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func (u *testUtil) ResultsComparer() bool {
passed := false

if test.ResultsCompareFunc == nil {
passed = CompareReflectDeepEqual(u, "", test.Results, test.Expected)
passed = CompareReflectDeepEqual(test.Results, test.Expected)
} else {
passed = test.ResultsCompareFunc(u, "", test.Results, test.Expected)
}
Expand All @@ -225,7 +225,7 @@ func (u *testUtil) ResultsComparer() bool {
func (u *testUtil) FieldComparer(name string, actual, expected interface{}) bool {
test := u.TestData()
if test.FieldCompareFunc == nil {
return CompareReflectDeepEqual(u, name, actual, expected)
return CompareReflectDeepEqual(actual, expected)
}

return test.FieldCompareFunc(u, name, actual, expected)
Expand Down
10 changes: 7 additions & 3 deletions pkg/testutils/test-utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ import (
"github.com/paul-carlton/goutils/pkg/logging"
)

const (
mb = 1024 * 1024
)

// Test utilities

// CopyObjectStatus copys an ObjectStatus object leaving Fields element empty.
Expand Down Expand Up @@ -311,7 +315,7 @@ func ReadBuf(out io.Reader) *[]string {
output := []string{}

for {
p := make([]byte, 1024000)
p := make([]byte, mb)
n, err := out.Read(p)

if n > 0 {
Expand Down Expand Up @@ -438,12 +442,12 @@ func CheckNotNil(u TestUtil, name string, a, e interface{}) bool {
}

// CompareJSON compares values by converting to json.
func CompareJSON(u TestUtil, name string, actual, expected interface{}) bool {
func CompareJSON(u TestUtil, _ string, actual, expected interface{}) bool {
return CompareAsJSON(u.Testing(), actual, expected)
}

// CompareReflectDeepEqual compares values using reflect.DeepEqual().
func CompareReflectDeepEqual(u TestUtil, name string, actual, expected interface{}) bool {
func CompareReflectDeepEqual(actual, expected interface{}) bool {
return reflect.DeepEqual(actual, expected)
}

Expand Down

0 comments on commit 7d201ff

Please sign in to comment.