This is an automated email from the ASF dual-hosted git repository.
tuhaihe pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry-go-libs.git
The following commit(s) were added to refs/heads/main by this push:
new 2200e2f Feature: modernize CI/CD with GitHub Actions
2200e2f is described below
commit 2200e2fedf3d05a0b5cfa751a0269b4c542e5625
Author: Dianjin Wang <[email protected]>
AuthorDate: Wed Sep 10 17:39:31 2025 +0800
Feature: modernize CI/CD with GitHub Actions
Replaced Concourse CI with GitHub Actions and upgraded to Go 1.25.
CI/CD Changes:
- Migrated from Concourse (ci/pipeline.yml) to GitHub Actions
- Added pipeline.yml with matrix strategy for parallel test/build
- Added code-check.yml for lint checks using native Go tools
- Added step summaries with test results and coverage reports
- Configured workflows for main branch and PR events
Go 1.25 Compatibility:
- Updated go.mod, Makefile, and workflows to Go 1.25
- Fixed format string errors in gplog calls with "%s" specifiers
- Fixed timeout test flakiness in cluster_test.go
Linting Improvements:
- Migrated .golangci.yml to v2 format (version, formats map)
- Simplified Makefile to use go install instead of Docker
- Fixed lint issues: errcheck, govet inline, unused symbols
- Aligned linter config with cloudberry-backup project conventions
---
.github/workflows/code-check.yml | 73 ++++++++++++++++--
.github/workflows/pipeline.yml | 134 ++++++++++++++++++++++++++++++++
.golangci.yml | 90 ++++++++++++++++------
Makefile | 43 ++++-------
ci/pipeline.yml | 35 ---------
cluster/cluster.go | 16 ++--
cluster/cluster_test.go | 3 +-
dbconn/dbconn.go | 2 +-
gplog/gplog.go | 2 +-
gplog/gplog_test.go | 148 ++++++++++++++++++------------------
structmatcher/structmatcher.go | 4 +-
structmatcher/structmatcher_test.go | 4 +-
12 files changed, 372 insertions(+), 182 deletions(-)
diff --git a/.github/workflows/code-check.yml b/.github/workflows/code-check.yml
index 3dbaf66..497bbcc 100644
--- a/.github/workflows/code-check.yml
+++ b/.github/workflows/code-check.yml
@@ -1,15 +1,76 @@
----
-name: code-style-check
+# --------------------------------------------------------------------
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed
+# with this work for additional information regarding copyright
+# ownership. The ASF licenses this file to You under the Apache
+# License, Version 2.0 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# permissions and limitations under the License.
+#
+# --------------------------------------------------------------------
+name: Code Quality Check
on:
pull_request:
- branches: [master]
+ branches: [ main ]
+ types: [ opened, synchronize, reopened, edited ]
+ workflow_dispatch:
+
+permissions:
+ contents: read
jobs:
lint:
+ name: Code Quality
runs-on: ubuntu-latest
+
steps:
- - uses: actions/checkout@v2
- - name: run check
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Set up Go
+ uses: actions/setup-go@v5
+ with:
+ go-version: '1.25'
+ cache: true
+
+ - name: Run code quality checks
run: |
- make lint
+ set +e
+ make lint 2>&1 | tee lint_output.txt
+ LINT_EXIT_CODE=${PIPESTATUS[0]}
+
+ # Generate lint summary
+ {
+ echo "## Code Quality Check Results"
+ if [ ${LINT_EXIT_CODE} -eq 0 ]; then
+ echo "PASS: All code quality checks passed!"
+ echo ""
+ echo "### Checks Performed"
+ echo "- Static analysis (golangci-lint)"
+ else
+ echo "FAIL: Code quality checks failed. Please fix the issues
above."
+ echo ""
+ echo "### How to Fix"
+ echo "Run \`make lint\` locally to see the issues."
+ echo "Run \`make format\` to auto-fix formatting issues."
+ echo ""
+ if [ -f lint_output.txt ]; then
+ echo "### Lint Output"
+ echo "\`\`\`"
+ tail -n 30 lint_output.txt
+ echo "\`\`\`"
+ fi
+ fi
+ } >> "$GITHUB_STEP_SUMMARY"
+
+ exit ${LINT_EXIT_CODE}
\ No newline at end of file
diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml
new file mode 100644
index 0000000..857dac6
--- /dev/null
+++ b/.github/workflows/pipeline.yml
@@ -0,0 +1,134 @@
+# --------------------------------------------------------------------
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed
+# with this work for additional information regarding copyright
+# ownership. The ASF licenses this file to You under the Apache
+# License, Version 2.0 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# permissions and limitations under the License.
+#
+# --------------------------------------------------------------------
+name: CI Pipeline
+
+on:
+ push:
+ branches: [ main ]
+ pull_request:
+ branches: [ main ]
+ types: [ opened, synchronize, reopened, edited ]
+ workflow_dispatch:
+
+permissions:
+ contents: read
+
+env:
+ GO_VERSION: '1.25'
+
+jobs:
+ ci:
+ name: ${{ matrix.target }}
+ runs-on: ubuntu-latest
+ strategy:
+ fail-fast: false
+ matrix:
+ target: [test, build]
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Set up Go
+ uses: actions/setup-go@v5
+ with:
+ go-version: ${{ env.GO_VERSION }}
+ cache: true
+
+ - name: Download dependencies
+ run: make depend
+
+ - name: Run CI target
+ env:
+ CI_TARGET: ${{ matrix.target }}
+ run: |
+ set +e
+ case "${CI_TARGET}" in
+ test)
+ echo "Running tests..."
+ make unit 2>&1 | tee test_output.txt
+ TEST_EXIT_CODE=${PIPESTATUS[0]}
+
+ if [ ${TEST_EXIT_CODE} -eq 0 ]; then
+ echo "Generating code coverage report..."
+ make coverage 2>&1 | tee coverage_output.txt || true
+ fi
+
+ # Generate test summary
+ {
+ echo "## Test Results"
+ if [ ${TEST_EXIT_CODE} -eq 0 ]; then
+ echo "PASS: All tests passed successfully!"
+ echo ""
+
+ if [ -f test_output.txt ]; then
+ echo "### Test Execution Summary"
+ echo "\`\`\`"
+ tail -n 10 test_output.txt | grep -E "(Ginkgo ran|Test
Suite)" || echo "Test summary not found"
+ echo "\`\`\`"
+ echo ""
+ fi
+
+ echo "### Code Coverage Report"
+ echo "\`\`\`"
+ if [ -f coverage_output.txt ]; then
+ cat coverage_output.txt
+ else
+ echo "Coverage report not available"
+ fi
+ echo "\`\`\`"
+ else
+ echo "FAIL: Some tests failed. Check the logs above for
details."
+ echo ""
+ if [ -f test_output.txt ]; then
+ echo "### Test Output"
+ echo "\`\`\`"
+ tail -n 20 test_output.txt
+ echo "\`\`\`"
+ fi
+ fi
+ } >> "$GITHUB_STEP_SUMMARY"
+
+ exit ${TEST_EXIT_CODE}
+ ;;
+
+ build)
+ echo "Building..."
+ go build -v ./...
+ BUILD_EXIT_CODE=$?
+
+ # Generate build summary
+ {
+ echo "## Build Results"
+ if [ ${BUILD_EXIT_CODE} -eq 0 ]; then
+ echo "PASS: Build completed successfully!"
+ else
+ echo "FAIL: Build failed. Check the logs above for details."
+ fi
+ } >> "$GITHUB_STEP_SUMMARY"
+
+ exit ${BUILD_EXIT_CODE}
+ ;;
+
+ *)
+ echo "Unknown CI target: ${CI_TARGET}"
+ exit 1
+ ;;
+ esac
diff --git a/.golangci.yml b/.golangci.yml
index 5ab6a77..a00057b 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -1,29 +1,69 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+version: "2"
+
linters:
- # please, do not use `enable-all`: it's deprecated and will be removed soon.
- # inverted configuration with `enable-all` and `disable` is not scalable
during updates of golangci-lint
- disable-all: true
+ default: none
enable:
- - golint
- - vet
- - varcheck
- - unparam
- errcheck
+ - govet
+ - revive
+ - unparam
+ - unused
+ settings:
+ govet:
+ enable:
+ - shadow
+ revive:
+ confidence: 0.1
+ exclusions:
+ generated: lax
+ rules:
+ - linters:
+ - revive
+ text: should have comment
+ - linters:
+ - revive
+ text: comment on exported
+ - linters:
+ - revive
+ text: should not use dot imports
+ - linters:
+ - revive
+ text: don't use ALL_CAPS in Go names; use CamelCase
+ - linters:
+ - revive
+ text: and that stutters
+ - linters:
+ - revive
+ text: don't use an underscore in package name
+ - linters:
+ - govet
+ text: "shadow:"
+ path: _test\.go
+ - linters:
+ - errcheck
+ path: _test\.go
+ - linters:
+ - unparam
+ path: _test\.go
+ paths:
+ - vendor
-issues:
- # List of regexps of issue texts to exclude, empty list by default.
- # But independently from this option we use default exclude patterns,
- # it can be disabled by `exclude-use-default: false`. To list all
- # excluded by default patterns execute `golangci-lint run --help`
- exclude:
- - "don't use ALL_CAPS in Go names; use CamelCase"
- - "should not use dot imports"
-
- exclude-rules:
- - path: _test\.go
- text: "don't use underscores in Go names"
- linters:
- - golint
-
- - path: _test\.go
- linters:
- - errcheck
+run:
+ timeout: 5m
diff --git a/Makefile b/Makefile
index d5cf195..8349cfa 100644
--- a/Makefile
+++ b/Makefile
@@ -5,30 +5,33 @@ SHELL := /bin/bash
DIR_PATH=$(shell dirname `pwd`)
BIN_DIR=$(shell echo $${GOPATH:-~/go} | awk -F':' '{ print $$1 "/bin"}')
BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
-GOLANG_VERSION = 1.19.6
-GINKGO=$(GOPATH)/bin/ginkgo
+GOLANG_VERSION = 1.25.0
+GINKGO=$(BIN_DIR)/ginkgo
DEST = .
GOFLAGS :=
+GOIMPORTS=$(BIN_DIR)/goimports
+GOLANG_LINTER=$(BIN_DIR)/golangci-lint
-.PHONY: test lint goimports golangci-lint gofmt unit coverage depend set-dev
set-prod
+.PHONY: test lint format unit coverage depend
test: lint unit
-lint:
- $(MAKE) goimports gofmt golangci-lint
+$(GOIMPORTS):
+ GOBIN=$(BIN_DIR) go install golang.org/x/tools/cmd/goimports@latest
-goimports:
- docker run --rm -i -v "${PWD}":/data -w /data unibeautify/goimports -w
-l /data
+LINTER_VERSION=v2.12.2
+$(GOLANG_LINTER):
+ GOBIN=$(BIN_DIR) go install
github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(LINTER_VERSION)
-golangci-lint:
- docker run --rm -v ${PWD}:/data -w /data golangci/golangci-lint
golangci-lint run -v
+format: $(GOIMPORTS)
+ @goimports -w $(shell find . -type f -name '*.go' -not -path
"./vendor/*")
-gofmt:
- docker run --rm -v ${PWD}:/data cytopia/gofmt --ci .
+lint: $(GOLANG_LINTER)
+ golangci-lint run
$(GINKGO):
- go install github.com/onsi/ginkgo/v2/ginkgo@latest
+ GOBIN=$(BIN_DIR) go install github.com/onsi/ginkgo/v2/[email protected]
unit: $(GINKGO)
ginkgo -r --keep-going --randomize-suites --randomize-all \
@@ -55,19 +58,3 @@ clean :
# Code coverage files
rm -rf /tmp/cover*
rm -rf /tmp/unit*
-
-##### Pipeline targets #####
-
-set-dev:
- fly --target dev set-pipeline --check-creds \
- --pipeline=dev-gp-common-go-libs-${BRANCH}-${USER} \
- -c ci/pipeline.yml \
- --var=branch=${BRANCH} \
- --var=golang-version=${GOLANG_VERSION}
-
-set-prod:
- fly --target prod set-pipeline --check-creds \
- --pipeline=gp-common-go-libs \
- -c ci/pipeline.yml \
- --var=branch=main\
- --var=golang-version=${GOLANG_VERSION}
diff --git a/ci/pipeline.yml b/ci/pipeline.yml
deleted file mode 100644
index c99e9ea..0000000
--- a/ci/pipeline.yml
+++ /dev/null
@@ -1,35 +0,0 @@
----
-resources:
-- name: cloudberry-go-libs
- type: git
- source:
- uri: https://github.com/apache/cloudberry-go-libs
- branch: ((branch))
-
-jobs:
-- name: unit-tests
- plan:
- - in_parallel:
- - get: cloudberry-go-libs
- trigger: true
- - task: unit-tests
- config:
- platform: linux
- image_resource:
- type: registry-image
- source:
- repository: golang
- tag: ((golang-version))-buster
- inputs:
- - name: cloudberry-go-libs
- path: go/src/github.com/apache/cloudberry-go-libs
- run:
- path: bash
- args:
- - -c
- - |
- set -ex
- export GOPATH=$PWD/go
- export PATH=$GOPATH/bin:$PATH
- cd $GOPATH/src/github.com/apache/cloudberry-go-libs
- make depend unit
diff --git a/cluster/cluster.go b/cluster/cluster.go
index 0c0422e..3476267 100644
--- a/cluster/cluster.go
+++ b/cluster/cluster.go
@@ -130,7 +130,7 @@ const (
INCLUDE_MIRRORS Scope = 1 << 3
)
-func scopeIsSegments(scope Scope) bool {
+func scopeIsSegments(scope Scope) bool { //nolint:unused // kept for API
symmetry with scopeIsHosts
return scope&ON_HOSTS == ON_SEGMENTS
}
@@ -142,11 +142,11 @@ func scopeExcludesCoordinator(scope Scope) bool {
return scope&INCLUDE_COORDINATOR == EXCLUDE_COORDINATOR
}
-func scopeIncludesCoordinator(scope Scope) bool {
+func scopeIncludesCoordinator(scope Scope) bool { //nolint:unused // kept for
API symmetry with scopeExcludesCoordinator
return scope&INCLUDE_COORDINATOR == INCLUDE_COORDINATOR
}
-func scopeIsRemote(scope Scope) bool {
+func scopeIsRemote(scope Scope) bool { //nolint:unused // kept for API
symmetry with scopeIsLocal
return scope&ON_LOCAL == ON_REMOTE
}
@@ -158,7 +158,7 @@ func scopeExcludesMirrors(scope Scope) bool {
return scope&INCLUDE_MIRRORS == EXCLUDE_MIRRORS
}
-func scopeIncludesMirrors(scope Scope) bool {
+func scopeIncludesMirrors(scope Scope) bool { //nolint:unused // kept for API
symmetry with scopeExcludesMirrors
return scope&INCLUDE_MIRRORS == INCLUDE_MIRRORS
}
@@ -418,7 +418,7 @@ func (executor *GPDBExecutor)
ExecuteClusterCommandWithRetries(scope Scope, comm
* - e.g. running multiple scps on coordinator to push a file to all
segments
*/
func (cluster *Cluster) GenerateAndExecuteCommand(verboseMsg string, scope
Scope, generator interface{}) *RemoteOutput {
- gplog.Verbose(verboseMsg)
+ gplog.Verbose("%s", verboseMsg)
commandList := cluster.GenerateSSHCommandList(scope, generator)
return cluster.ExecuteClusterCommandWithRetries(scope, commandList, 5,
1*time.Second)
}
@@ -455,7 +455,7 @@ func (cluster *Cluster) CheckClusterError(remoteOutput
*RemoteOutput, finalErrMs
}
if len(noFatal) == 1 && noFatal[0] == true {
- gplog.Error(finalErrMsg)
+ gplog.Error("%s", finalErrMsg)
} else {
LogFatalClusterError(finalErrMsg, remoteOutput.Scope,
remoteOutput.NumErrors)
}
@@ -700,7 +700,9 @@ func GetSegmentConfigurationFromFile(coordinatorDataDir
string) ([]SegConfig, er
if err != nil {
return nil, fmt.Errorf("Failed to open file %s. Error: %s",
gpsegconfigDump, err.Error())
}
- defer fd.Close()
+ defer func() {
+ _ = fd.Close()
+ }()
results := make([]SegConfig, 0)
scanner := bufio.NewScanner(fd)
diff --git a/cluster/cluster_test.go b/cluster/cluster_test.go
index 4e612e6..6f03a06 100644
--- a/cluster/cluster_test.go
+++ b/cluster/cluster_test.go
@@ -500,7 +500,8 @@ var _ = Describe("cluster/cluster tests", func() {
It("kills the command if it runs beyond the timeout", func() {
testCluster := cluster.Cluster{}
commandStr := "while true; do echo Keep running; sleep
0.1; done"
- ctx, _ := context.WithTimeout(context.Background(),
200*time.Millisecond)
+ ctx, cancel :=
context.WithTimeout(context.Background(), 200*time.Millisecond)
+ defer cancel()
testCluster.Executor = &cluster.GPDBExecutor{}
output, err :=
testCluster.ExecuteLocalCommandWithContext(commandStr, ctx)
Expect(ctx.Err()).To(Equal(context.DeadlineExceeded))
diff --git a/dbconn/dbconn.go b/dbconn/dbconn.go
index 755cb2f..823009c 100644
--- a/dbconn/dbconn.go
+++ b/dbconn/dbconn.go
@@ -224,7 +224,7 @@ func (dbconn *DBConn) Connect(numConns int, utilityMode
...bool) error {
sessionRoleConnStr := connStr + " gp_session_role=utility"
utilConn, err := dbconn.Driver.Connect("pgx",
sessionRoleConnStr)
if utilConn != nil {
- utilConn.Close()
+ _ = utilConn.Close()
}
if err != nil {
if strings.Contains(err.Error(), `unrecognized
configuration parameter "gp_session_role"`) {
diff --git a/gplog/gplog.go b/gplog/gplog.go
index 4a6f08d..4ce4116 100644
--- a/gplog/gplog.go
+++ b/gplog/gplog.go
@@ -435,7 +435,7 @@ func FatalOnError(err error, output ...string) {
if len(output) == 0 {
Fatal(err, "")
} else {
- Fatal(err, output[0])
+ Fatal(err, "%s", output[0])
}
}
}
diff --git a/gplog/gplog_test.go b/gplog/gplog_test.go
index a46507b..d2bbfeb 100644
--- a/gplog/gplog_test.go
+++ b/gplog/gplog_test.go
@@ -221,7 +221,7 @@ var _ = Describe("logger/log tests", func() {
Context("Info", func() {
It("prints to the log file", func() {
expectedMessage := "error info"
- gplog.Info(expectedMessage)
+ gplog.Info("%s", expectedMessage)
testhelper.NotExpectRegexp(stdout,
infoExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
infoExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
infoExpected+expectedMessage)
@@ -230,7 +230,7 @@ var _ = Describe("logger/log tests", func() {
Context("Success", func() {
It("prints to the log file", func() {
expectedMessage := "error info"
- gplog.Success(expectedMessage)
+ gplog.Success("%s", expectedMessage)
testhelper.NotExpectRegexp(stdout,
infoExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
infoExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
infoExpected+expectedMessage)
@@ -239,7 +239,7 @@ var _ = Describe("logger/log tests", func() {
Context("Warn", func() {
It("prints to stdout and the log file", func() {
expectedMessage := "error warn"
- gplog.Warn(expectedMessage)
+ gplog.Warn("%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
warnExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
warnExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
warnExpected+expectedMessage)
@@ -248,7 +248,7 @@ var _ = Describe("logger/log tests", func() {
Context("Verbose", func() {
It("prints to the log file", func() {
expectedMessage := "error verbose"
- gplog.Verbose(expectedMessage)
+ gplog.Verbose("%s", expectedMessage)
testhelper.NotExpectRegexp(stdout,
verboseExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
verboseExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
verboseExpected+expectedMessage)
@@ -257,7 +257,7 @@ var _ = Describe("logger/log tests", func() {
Context("Debug", func() {
It("prints to the log file", func() {
expectedMessage := "error debug"
- gplog.Debug(expectedMessage)
+ gplog.Debug("%s", expectedMessage)
testhelper.NotExpectRegexp(stdout,
debugExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
debugExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
debugExpected+expectedMessage)
@@ -266,7 +266,7 @@ var _ = Describe("logger/log tests", func() {
Context("Error", func() {
It("prints to stderr and the log file", func() {
expectedMessage := "error error"
- gplog.Error(expectedMessage)
+ gplog.Error("%s", expectedMessage)
testhelper.NotExpectRegexp(stdout,
errorExpected+expectedMessage)
testhelper.ExpectRegexp(stderr,
errorExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
errorExpected+expectedMessage)
@@ -287,7 +287,7 @@ var _ = Describe("logger/log tests", func() {
Context("Custom with shell as error and file as
verbose", func() {
It("prints to stderr and the log file", func() {
expectedMessage := "error custom"
- gplog.Custom(gplog.LOGVERBOSE,
gplog.LOGERROR, expectedMessage)
+ gplog.Custom(gplog.LOGVERBOSE,
gplog.LOGERROR, "%s", expectedMessage)
testhelper.NotExpectRegexp(stdout,
errorExpected+expectedMessage)
testhelper.ExpectRegexp(stderr,
errorExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
verboseExpected+expectedMessage)
@@ -296,7 +296,7 @@ var _ = Describe("logger/log tests", func() {
Context("Custom with shell as verbose and file as
verbose", func() {
It("prints to the log file", func() {
expectedMessage := "error custom"
- gplog.Custom(gplog.LOGVERBOSE,
gplog.LOGVERBOSE, expectedMessage)
+ gplog.Custom(gplog.LOGVERBOSE,
gplog.LOGVERBOSE, "%s", expectedMessage)
testhelper.NotExpectRegexp(stdout,
verboseExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
verboseExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
verboseExpected+expectedMessage)
@@ -305,7 +305,7 @@ var _ = Describe("logger/log tests", func() {
Context("Custom with shell as info and file as error",
func() {
It("prints to the log file", func() {
expectedMessage := "error custom"
- gplog.Custom(gplog.LOGERROR,
gplog.LOGINFO, expectedMessage)
+ gplog.Custom(gplog.LOGERROR,
gplog.LOGINFO, "%s", expectedMessage)
testhelper.NotExpectRegexp(stdout,
infoExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
infoExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
errorExpected+expectedMessage)
@@ -321,7 +321,7 @@ var _ = Describe("logger/log tests", func() {
Context("Info", func() {
It("prints to stdout and the log file", func() {
expectedMessage := "info info"
- gplog.Info(expectedMessage)
+ gplog.Info("%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
infoExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
infoExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
infoExpected+expectedMessage)
@@ -330,7 +330,7 @@ var _ = Describe("logger/log tests", func() {
Context("Success", func() {
It("prints to stdout and the log file", func() {
expectedMessage := "info info"
- gplog.Success(expectedMessage)
+ gplog.Success("%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
infoExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
infoExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
infoExpected+expectedMessage)
@@ -339,7 +339,7 @@ var _ = Describe("logger/log tests", func() {
Context("Warn", func() {
It("prints to stdout and the log file", func() {
expectedMessage := "info warn"
- gplog.Warn(expectedMessage)
+ gplog.Warn("%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
warnExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
warnExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
warnExpected+expectedMessage)
@@ -348,7 +348,7 @@ var _ = Describe("logger/log tests", func() {
Context("Verbose", func() {
It("prints to the log file", func() {
expectedMessage := "info verbose"
- gplog.Verbose(expectedMessage)
+ gplog.Verbose("%s", expectedMessage)
testhelper.NotExpectRegexp(stdout,
verboseExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
verboseExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
verboseExpected+expectedMessage)
@@ -357,7 +357,7 @@ var _ = Describe("logger/log tests", func() {
Context("Debug", func() {
It("prints to the log file", func() {
expectedMessage := "info debug"
- gplog.Debug(expectedMessage)
+ gplog.Debug("%s", expectedMessage)
testhelper.NotExpectRegexp(stdout,
debugExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
debugExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
debugExpected+expectedMessage)
@@ -366,7 +366,7 @@ var _ = Describe("logger/log tests", func() {
Context("Error", func() {
It("prints to stderr and the log file", func() {
expectedMessage := "info error"
- gplog.Error(expectedMessage)
+ gplog.Error("%s", expectedMessage)
testhelper.NotExpectRegexp(stdout,
errorExpected+expectedMessage)
testhelper.ExpectRegexp(stderr,
errorExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
errorExpected+expectedMessage)
@@ -387,7 +387,7 @@ var _ = Describe("logger/log tests", func() {
Context("Custom with shell as error and file as
verbose", func() {
It("prints to stderr and the log file", func() {
expectedMessage := "info custom"
- gplog.Custom(gplog.LOGVERBOSE,
gplog.LOGERROR, expectedMessage)
+ gplog.Custom(gplog.LOGVERBOSE,
gplog.LOGERROR, "%s", expectedMessage)
testhelper.NotExpectRegexp(stdout,
errorExpected+expectedMessage)
testhelper.ExpectRegexp(stderr,
errorExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
verboseExpected+expectedMessage)
@@ -396,7 +396,7 @@ var _ = Describe("logger/log tests", func() {
Context("Custom with shell as verbose and file as
verbose", func() {
It("prints to the log file", func() {
expectedMessage := "info custom"
- gplog.Custom(gplog.LOGVERBOSE,
gplog.LOGVERBOSE, expectedMessage)
+ gplog.Custom(gplog.LOGVERBOSE,
gplog.LOGVERBOSE, "%s", expectedMessage)
testhelper.NotExpectRegexp(stdout,
verboseExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
verboseExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
verboseExpected+expectedMessage)
@@ -405,7 +405,7 @@ var _ = Describe("logger/log tests", func() {
Context("Custom with shell as info and file as error",
func() {
It("prints to stdout and the log file", func() {
expectedMessage := "info custom"
- gplog.Custom(gplog.LOGERROR,
gplog.LOGINFO, expectedMessage)
+ gplog.Custom(gplog.LOGERROR,
gplog.LOGINFO, "%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
infoExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
infoExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
errorExpected+expectedMessage)
@@ -421,7 +421,7 @@ var _ = Describe("logger/log tests", func() {
Context("Info", func() {
It("prints to stdout and the log file", func() {
expectedMessage := "verbose info"
- gplog.Info(expectedMessage)
+ gplog.Info("%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
infoExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
infoExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
infoExpected+expectedMessage)
@@ -430,7 +430,7 @@ var _ = Describe("logger/log tests", func() {
Context("Success", func() {
It("prints to stdout and the log file", func() {
expectedMessage := "verbose info"
- gplog.Success(expectedMessage)
+ gplog.Success("%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
infoExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
infoExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
infoExpected+expectedMessage)
@@ -439,7 +439,7 @@ var _ = Describe("logger/log tests", func() {
Context("Warn", func() {
It("prints to stdout and the log file", func() {
expectedMessage := "verbose warn"
- gplog.Warn(expectedMessage)
+ gplog.Warn("%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
warnExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
warnExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
warnExpected+expectedMessage)
@@ -448,7 +448,7 @@ var _ = Describe("logger/log tests", func() {
Context("Verbose", func() {
It("prints to stdout and the log file", func() {
expectedMessage := "verbose verbose"
- gplog.Verbose(expectedMessage)
+ gplog.Verbose("%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
verboseExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
verboseExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
verboseExpected+expectedMessage)
@@ -457,7 +457,7 @@ var _ = Describe("logger/log tests", func() {
Context("Debug", func() {
It("prints to the log file", func() {
expectedMessage := "verbose debug"
- gplog.Debug(expectedMessage)
+ gplog.Debug("%s", expectedMessage)
testhelper.NotExpectRegexp(stdout,
debugExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
debugExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
debugExpected+expectedMessage)
@@ -466,7 +466,7 @@ var _ = Describe("logger/log tests", func() {
Context("Error", func() {
It("prints to stderr and the log file", func() {
expectedMessage := "verbose error"
- gplog.Error(expectedMessage)
+ gplog.Error("%s", expectedMessage)
testhelper.NotExpectRegexp(stdout,
errorExpected+expectedMessage)
testhelper.ExpectRegexp(stderr,
errorExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
errorExpected+expectedMessage)
@@ -488,7 +488,7 @@ var _ = Describe("logger/log tests", func() {
Context("Custom with shell as error and file as
verbose", func() {
It("prints to stderr and the log file", func() {
expectedMessage := "verbose custom"
- gplog.Custom(gplog.LOGVERBOSE,
gplog.LOGERROR, expectedMessage)
+ gplog.Custom(gplog.LOGVERBOSE,
gplog.LOGERROR, "%s", expectedMessage)
testhelper.NotExpectRegexp(stdout,
errorExpected+expectedMessage)
testhelper.ExpectRegexp(stderr,
errorExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
verboseExpected+expectedMessage)
@@ -497,7 +497,7 @@ var _ = Describe("logger/log tests", func() {
Context("Custom with shell as verbose and file as
verbose", func() {
It("prints to stdout and the log file", func() {
expectedMessage := "verbose custom"
- gplog.Custom(gplog.LOGVERBOSE,
gplog.LOGVERBOSE, expectedMessage)
+ gplog.Custom(gplog.LOGVERBOSE,
gplog.LOGVERBOSE, "%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
verboseExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
verboseExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
verboseExpected+expectedMessage)
@@ -506,7 +506,7 @@ var _ = Describe("logger/log tests", func() {
Context("Custom with shell as info and file as error",
func() {
It("prints to stdout and the log file", func() {
expectedMessage := "verbose custom"
- gplog.Custom(gplog.LOGERROR,
gplog.LOGINFO, expectedMessage)
+ gplog.Custom(gplog.LOGERROR,
gplog.LOGINFO, "%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
infoExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
infoExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
errorExpected+expectedMessage)
@@ -522,7 +522,7 @@ var _ = Describe("logger/log tests", func() {
Context("Info", func() {
It("prints to stdout and the log file", func() {
expectedMessage := "debug info"
- gplog.Info(expectedMessage)
+ gplog.Info("%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
infoExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
infoExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
infoExpected+expectedMessage)
@@ -531,7 +531,7 @@ var _ = Describe("logger/log tests", func() {
Context("Success", func() {
It("prints to stdout and the log file", func() {
expectedMessage := "debug info"
- gplog.Success(expectedMessage)
+ gplog.Success("%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
infoExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
infoExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
infoExpected+expectedMessage)
@@ -540,7 +540,7 @@ var _ = Describe("logger/log tests", func() {
Context("Warn", func() {
It("prints to stdout and the log file", func() {
expectedMessage := "debug warn"
- gplog.Warn(expectedMessage)
+ gplog.Warn("%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
warnExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
warnExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
warnExpected+expectedMessage)
@@ -549,7 +549,7 @@ var _ = Describe("logger/log tests", func() {
Context("Verbose", func() {
It("prints to stdout and the log file", func() {
expectedMessage := "debug verbose"
- gplog.Verbose(expectedMessage)
+ gplog.Verbose("%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
verboseExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
verboseExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
verboseExpected+expectedMessage)
@@ -558,7 +558,7 @@ var _ = Describe("logger/log tests", func() {
Context("Debug", func() {
It("prints to stdout and the log file", func() {
expectedMessage := "debug debug"
- gplog.Debug(expectedMessage)
+ gplog.Debug("%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
debugExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
debugExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
debugExpected+expectedMessage)
@@ -567,7 +567,7 @@ var _ = Describe("logger/log tests", func() {
Context("Error", func() {
It("prints to stderr and the log file", func() {
expectedMessage := "debug error"
- gplog.Error(expectedMessage)
+ gplog.Error("%s", expectedMessage)
testhelper.NotExpectRegexp(stdout,
errorExpected+expectedMessage)
testhelper.ExpectRegexp(stderr,
errorExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
errorExpected+expectedMessage)
@@ -588,7 +588,7 @@ var _ = Describe("logger/log tests", func() {
Context("Custom with shell as error and file as
verbose", func() {
It("prints to stderr and the log file", func() {
expectedMessage := "debug custom"
- gplog.Custom(gplog.LOGVERBOSE,
gplog.LOGERROR, expectedMessage)
+ gplog.Custom(gplog.LOGVERBOSE,
gplog.LOGERROR, "%s", expectedMessage)
testhelper.NotExpectRegexp(stdout,
errorExpected+expectedMessage)
testhelper.ExpectRegexp(stderr,
errorExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
verboseExpected+expectedMessage)
@@ -597,7 +597,7 @@ var _ = Describe("logger/log tests", func() {
Context("Custom with shell as verbose and file as
verbose", func() {
It("prints to stdout and the log file", func() {
expectedMessage := "debug custom"
- gplog.Custom(gplog.LOGVERBOSE,
gplog.LOGVERBOSE, expectedMessage)
+ gplog.Custom(gplog.LOGVERBOSE,
gplog.LOGVERBOSE, "%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
verboseExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
verboseExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
verboseExpected+expectedMessage)
@@ -606,7 +606,7 @@ var _ = Describe("logger/log tests", func() {
Context("Custom with shell as info and file as error",
func() {
It("prints to stdout and the log file", func() {
expectedMessage := "debug custom"
- gplog.Custom(gplog.LOGERROR,
gplog.LOGINFO, expectedMessage)
+ gplog.Custom(gplog.LOGERROR,
gplog.LOGINFO, "%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
infoExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
infoExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
errorExpected+expectedMessage)
@@ -625,7 +625,7 @@ var _ = Describe("logger/log tests", func() {
Context("Info", func() {
It("prints to stdout", func() {
expectedMessage := "logfile error info"
- gplog.Info(expectedMessage)
+ gplog.Info("%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
infoExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
infoExpected+expectedMessage)
testhelper.NotExpectRegexp(logfile,
infoExpected+expectedMessage)
@@ -634,7 +634,7 @@ var _ = Describe("logger/log tests", func() {
Context("Success", func() {
It("prints to stdout", func() {
expectedMessage := "logfile error info"
- gplog.Success(expectedMessage)
+ gplog.Success("%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
infoExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
infoExpected+expectedMessage)
testhelper.NotExpectRegexp(logfile,
infoExpected+expectedMessage)
@@ -643,7 +643,7 @@ var _ = Describe("logger/log tests", func() {
Context("Warn", func() {
It("prints to stdout and the log file", func() {
expectedMessage := "logfile error warn"
- gplog.Warn(expectedMessage)
+ gplog.Warn("%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
warnExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
warnExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
warnExpected+expectedMessage)
@@ -652,7 +652,7 @@ var _ = Describe("logger/log tests", func() {
Context("Verbose", func() {
It("does not print", func() {
expectedMessage := "logfile error
verbose"
- gplog.Verbose(expectedMessage)
+ gplog.Verbose("%s", expectedMessage)
testhelper.NotExpectRegexp(stdout,
verboseExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
verboseExpected+expectedMessage)
testhelper.NotExpectRegexp(logfile,
verboseExpected+expectedMessage)
@@ -661,7 +661,7 @@ var _ = Describe("logger/log tests", func() {
Context("Debug", func() {
It("does not print", func() {
expectedMessage := "logfile error debug"
- gplog.Debug(expectedMessage)
+ gplog.Debug("%s", expectedMessage)
testhelper.NotExpectRegexp(stdout,
debugExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
debugExpected+expectedMessage)
testhelper.NotExpectRegexp(logfile,
debugExpected+expectedMessage)
@@ -670,7 +670,7 @@ var _ = Describe("logger/log tests", func() {
Context("Error", func() {
It("prints to stderr and the log file", func() {
expectedMessage := "logfile error error"
- gplog.Error(expectedMessage)
+ gplog.Error("%s", expectedMessage)
testhelper.NotExpectRegexp(stdout,
errorExpected+expectedMessage)
testhelper.ExpectRegexp(stderr,
errorExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
errorExpected+expectedMessage)
@@ -692,7 +692,7 @@ var _ = Describe("logger/log tests", func() {
It("prints to the log file, then exit(1)",
func() {
gplog.SetExitFunc(func() {})
expectedMessage := "logfile error
fatalwithoutpanic"
- gplog.FatalWithoutPanic(expectedMessage)
+ gplog.FatalWithoutPanic("%s",
expectedMessage)
testhelper.NotExpectRegexp(stdout,
fatalExpected+expectedMessage)
testhelper.ExpectRegexp(stderr,
fatalExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
fatalExpected+expectedMessage)
@@ -701,7 +701,7 @@ var _ = Describe("logger/log tests", func() {
Context("Custom with shell as error and file as
verbose", func() {
It("prints to stderr", func() {
expectedMessage := "logfile error
custom"
- gplog.Custom(gplog.LOGVERBOSE,
gplog.LOGERROR, expectedMessage)
+ gplog.Custom(gplog.LOGVERBOSE,
gplog.LOGERROR, "%s", expectedMessage)
testhelper.NotExpectRegexp(stdout,
errorExpected+expectedMessage)
testhelper.ExpectRegexp(stderr,
errorExpected+expectedMessage)
testhelper.NotExpectRegexp(logfile,
verboseExpected+expectedMessage)
@@ -710,7 +710,7 @@ var _ = Describe("logger/log tests", func() {
Context("Custom with shell as verbose and file as
verbose", func() {
It("does not print", func() {
expectedMessage := "logfile error
custom"
- gplog.Custom(gplog.LOGVERBOSE,
gplog.LOGVERBOSE, expectedMessage)
+ gplog.Custom(gplog.LOGVERBOSE,
gplog.LOGVERBOSE, "%s", expectedMessage)
testhelper.NotExpectRegexp(stdout,
verboseExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
verboseExpected+expectedMessage)
testhelper.NotExpectRegexp(logfile,
verboseExpected+expectedMessage)
@@ -719,7 +719,7 @@ var _ = Describe("logger/log tests", func() {
Context("Custom with shell as info and file as error",
func() {
It("prints to stdout and the log file", func() {
expectedMessage := "info custom"
- gplog.Custom(gplog.LOGERROR,
gplog.LOGINFO, expectedMessage)
+ gplog.Custom(gplog.LOGERROR,
gplog.LOGINFO, "%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
infoExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
infoExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
errorExpected+expectedMessage)
@@ -738,7 +738,7 @@ var _ = Describe("logger/log tests", func() {
Context("Info", func() {
It("prints to stdout and the log file", func() {
expectedMessage := "logfile info info"
- gplog.Info(expectedMessage)
+ gplog.Info("%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
infoExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
infoExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
infoExpected+expectedMessage)
@@ -747,7 +747,7 @@ var _ = Describe("logger/log tests", func() {
Context("Success", func() {
It("prints to stdout and the log file", func() {
expectedMessage := "logfile info info"
- gplog.Success(expectedMessage)
+ gplog.Success("%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
infoExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
infoExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
infoExpected+expectedMessage)
@@ -756,7 +756,7 @@ var _ = Describe("logger/log tests", func() {
Context("Warn", func() {
It("prints to stdout and the log file", func() {
expectedMessage := "logfile info warn"
- gplog.Warn(expectedMessage)
+ gplog.Warn("%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
warnExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
warnExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
warnExpected+expectedMessage)
@@ -765,7 +765,7 @@ var _ = Describe("logger/log tests", func() {
Context("Verbose", func() {
It("does not print", func() {
expectedMessage := "logfile info
verbose"
- gplog.Verbose(expectedMessage)
+ gplog.Verbose("%s", expectedMessage)
testhelper.NotExpectRegexp(stdout,
verboseExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
verboseExpected+expectedMessage)
testhelper.NotExpectRegexp(logfile,
verboseExpected+expectedMessage)
@@ -774,7 +774,7 @@ var _ = Describe("logger/log tests", func() {
Context("Debug", func() {
It("does not print", func() {
expectedMessage := "logfile info debug"
- gplog.Debug(expectedMessage)
+ gplog.Debug("%s", expectedMessage)
testhelper.NotExpectRegexp(stdout,
debugExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
debugExpected+expectedMessage)
testhelper.NotExpectRegexp(logfile,
debugExpected+expectedMessage)
@@ -783,7 +783,7 @@ var _ = Describe("logger/log tests", func() {
Context("Error", func() {
It("prints to stderr and the log file", func() {
expectedMessage := "logfile info error"
- gplog.Error(expectedMessage)
+ gplog.Error("%s", expectedMessage)
testhelper.NotExpectRegexp(stdout,
errorExpected+expectedMessage)
testhelper.ExpectRegexp(stderr,
errorExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
errorExpected+expectedMessage)
@@ -805,7 +805,7 @@ var _ = Describe("logger/log tests", func() {
It("prints to the log file, then exit(1)",
func() {
gplog.SetExitFunc(func() {})
expectedMessage := "logfile info
fatalwithoutpanic"
- gplog.FatalWithoutPanic(expectedMessage)
+ gplog.FatalWithoutPanic("%s",
expectedMessage)
testhelper.NotExpectRegexp(stdout,
fatalExpected+expectedMessage)
testhelper.ExpectRegexp(stderr,
fatalExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
fatalExpected+expectedMessage)
@@ -814,7 +814,7 @@ var _ = Describe("logger/log tests", func() {
Context("Custom with shell as error and file as
verbose", func() {
It("prints to stderr", func() {
expectedMessage := "logfile info custom"
- gplog.Custom(gplog.LOGVERBOSE,
gplog.LOGERROR, expectedMessage)
+ gplog.Custom(gplog.LOGVERBOSE,
gplog.LOGERROR, "%s", expectedMessage)
testhelper.NotExpectRegexp(stdout,
errorExpected+expectedMessage)
testhelper.ExpectRegexp(stderr,
errorExpected+expectedMessage)
testhelper.NotExpectRegexp(logfile,
verboseExpected+expectedMessage)
@@ -823,7 +823,7 @@ var _ = Describe("logger/log tests", func() {
Context("Custom with shell as verbose and file as
verbose", func() {
It("does not print", func() {
expectedMessage := "logfile info custom"
- gplog.Custom(gplog.LOGVERBOSE,
gplog.LOGVERBOSE, expectedMessage)
+ gplog.Custom(gplog.LOGVERBOSE,
gplog.LOGVERBOSE, "%s", expectedMessage)
testhelper.NotExpectRegexp(stdout,
verboseExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
verboseExpected+expectedMessage)
testhelper.NotExpectRegexp(logfile,
verboseExpected+expectedMessage)
@@ -832,7 +832,7 @@ var _ = Describe("logger/log tests", func() {
Context("Custom with shell as info and file as error",
func() {
It("prints to stdout and the log file", func() {
expectedMessage := "info custom"
- gplog.Custom(gplog.LOGERROR,
gplog.LOGINFO, expectedMessage)
+ gplog.Custom(gplog.LOGERROR,
gplog.LOGINFO, "%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
infoExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
infoExpected+expectedMessage)
testhelper.ExpectRegexp(logfile,
errorExpected+expectedMessage)
@@ -857,7 +857,7 @@ var _ = Describe("logger/log tests", func() {
Context("Info", func() {
It("prints to stdout and the log file", func() {
expectedMessage := "debug info"
- gplog.Info(expectedMessage)
+ gplog.Info("%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
expectedMessage)
testhelper.NotExpectRegexp(stdout,
infoExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
expectedMessage)
@@ -867,7 +867,7 @@ var _ = Describe("logger/log tests", func() {
Context("Success", func() {
It("prints to stdout and the log file", func() {
expectedMessage := "debug info"
- gplog.Success(expectedMessage)
+ gplog.Success("%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
expectedMessage)
testhelper.NotExpectRegexp(stdout,
infoExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
expectedMessage)
@@ -877,7 +877,7 @@ var _ = Describe("logger/log tests", func() {
Context("Warn", func() {
It("prints to stdout and the log file", func() {
expectedMessage := "debug warn"
- gplog.Warn(expectedMessage)
+ gplog.Warn("%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
"WARNING: "+expectedMessage)
testhelper.NotExpectRegexp(stdout,
warnExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
"WARNING: "+expectedMessage)
@@ -887,7 +887,7 @@ var _ = Describe("logger/log tests", func() {
Context("Verbose", func() {
It("prints to stdout and the log file", func() {
expectedMessage := "debug verbose"
- gplog.Verbose(expectedMessage)
+ gplog.Verbose("%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
expectedMessage)
testhelper.NotExpectRegexp(stdout,
verboseExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
expectedMessage)
@@ -897,7 +897,7 @@ var _ = Describe("logger/log tests", func() {
Context("Debug", func() {
It("prints to stdout and the log file", func() {
expectedMessage := "debug debug"
- gplog.Debug(expectedMessage)
+ gplog.Debug("%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
expectedMessage)
testhelper.NotExpectRegexp(stdout,
debugExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
expectedMessage)
@@ -907,7 +907,7 @@ var _ = Describe("logger/log tests", func() {
Context("Error", func() {
It("prints to stderr and the log file", func() {
expectedMessage := "debug error"
- gplog.Error(expectedMessage)
+ gplog.Error("%s", expectedMessage)
testhelper.NotExpectRegexp(stdout,
expectedMessage)
testhelper.ExpectRegexp(stderr, "ERROR:
"+expectedMessage)
testhelper.NotExpectRegexp(stderr,
errorExpected+expectedMessage)
@@ -931,7 +931,7 @@ var _ = Describe("logger/log tests", func() {
Context("Custom with shell as error and file as
verbose", func() {
It("prints to stderr and the log file", func() {
expectedMessage := "debug custom"
- gplog.Custom(gplog.LOGVERBOSE,
gplog.LOGERROR, expectedMessage)
+ gplog.Custom(gplog.LOGVERBOSE,
gplog.LOGERROR, "%s", expectedMessage)
testhelper.NotExpectRegexp(stdout,
expectedMessage)
testhelper.ExpectRegexp(stderr, "ERROR:
"+expectedMessage)
testhelper.NotExpectRegexp(stderr,
errorExpected+expectedMessage)
@@ -941,7 +941,7 @@ var _ = Describe("logger/log tests", func() {
Context("Custom with shell as verbose and file as
verbose", func() {
It("prints to stdout and the log file", func() {
expectedMessage := "debug custom"
- gplog.Custom(gplog.LOGVERBOSE,
gplog.LOGVERBOSE, expectedMessage)
+ gplog.Custom(gplog.LOGVERBOSE,
gplog.LOGVERBOSE, "%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
expectedMessage)
testhelper.NotExpectRegexp(stdout,
verboseExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
expectedMessage)
@@ -951,7 +951,7 @@ var _ = Describe("logger/log tests", func() {
Context("Custom with shell as info and file as error",
func() {
It("prints to stdout and the log file", func() {
expectedMessage := "debug custom"
- gplog.Custom(gplog.LOGERROR,
gplog.LOGINFO, expectedMessage)
+ gplog.Custom(gplog.LOGERROR,
gplog.LOGINFO, "%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
expectedMessage)
testhelper.NotExpectRegexp(stdout,
infoExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
expectedMessage)
@@ -979,7 +979,7 @@ var _ = Describe("logger/log tests", func() {
Context("Info", func() {
It("prints to stdout and the log file", func() {
expectedMessage := "debug info"
- gplog.Info(expectedMessage)
+ gplog.Info("%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
expectedMessage)
testhelper.NotExpectRegexp(stdout,
infoExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
expectedMessage)
@@ -990,7 +990,7 @@ var _ = Describe("logger/log tests", func() {
It("prints to stdout and the log file", func() {
expectedMessage := "debug success"
expectedConsoleMessage :=
fmt.Sprintf("%[1]s[32mdebug success%[1]s[0m", "\x1b")
- gplog.Success(expectedMessage)
+ gplog.Success("%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
expectedConsoleMessage)
testhelper.NotExpectRegexp(stdout,
infoExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
expectedMessage)
@@ -1001,7 +1001,7 @@ var _ = Describe("logger/log tests", func() {
It("prints to stdout and the log file", func() {
expectedMessage := "debug warn"
expectedConsoleMessage :=
fmt.Sprintf("%[1]s[33mWARNING: debug warn%[1]s[0m", "\x1b")
- gplog.Warn(expectedMessage)
+ gplog.Warn("%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
expectedConsoleMessage)
testhelper.NotExpectRegexp(stdout,
warnExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
expectedMessage)
@@ -1011,7 +1011,7 @@ var _ = Describe("logger/log tests", func() {
Context("Verbose", func() {
It("prints to stdout and the log file", func() {
expectedMessage := "debug verbose"
- gplog.Verbose(expectedMessage)
+ gplog.Verbose("%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
expectedMessage)
testhelper.NotExpectRegexp(stdout,
verboseExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
expectedMessage)
@@ -1021,7 +1021,7 @@ var _ = Describe("logger/log tests", func() {
Context("Debug", func() {
It("prints to stdout and the log file", func() {
expectedMessage := "debug debug"
- gplog.Debug(expectedMessage)
+ gplog.Debug("%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
expectedMessage)
testhelper.NotExpectRegexp(stdout,
debugExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
expectedMessage)
@@ -1032,7 +1032,7 @@ var _ = Describe("logger/log tests", func() {
It("prints to stderr and the log file", func() {
expectedMessage := "debug error"
expectedConsoleMessage :=
fmt.Sprintf("%[1]s[31mERROR: debug error%[1]s[0m", "\x1b")
- gplog.Error(expectedMessage)
+ gplog.Error("%s", expectedMessage)
testhelper.NotExpectRegexp(stdout,
expectedMessage)
testhelper.ExpectRegexp(stderr,
expectedConsoleMessage)
testhelper.NotExpectRegexp(stderr,
errorExpected+expectedMessage)
@@ -1057,7 +1057,7 @@ var _ = Describe("logger/log tests", func() {
It("prints to stderr and the log file", func() {
expectedMessage := "debug custom"
expectedConsoleMessage :=
fmt.Sprintf("%[1]s[31mERROR: debug custom%[1]s[0m", "\x1b")
- gplog.Custom(gplog.LOGVERBOSE,
gplog.LOGERROR, expectedMessage)
+ gplog.Custom(gplog.LOGVERBOSE,
gplog.LOGERROR, "%s", expectedMessage)
testhelper.NotExpectRegexp(stdout,
expectedMessage)
testhelper.ExpectRegexp(stderr,
expectedConsoleMessage)
testhelper.NotExpectRegexp(stderr,
errorExpected+expectedMessage)
@@ -1067,7 +1067,7 @@ var _ = Describe("logger/log tests", func() {
Context("Custom with shell as verbose and file as
verbose", func() {
It("prints to stdout and the log file", func() {
expectedMessage := "debug custom"
- gplog.Custom(gplog.LOGVERBOSE,
gplog.LOGVERBOSE, expectedMessage)
+ gplog.Custom(gplog.LOGVERBOSE,
gplog.LOGVERBOSE, "%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
expectedMessage)
testhelper.NotExpectRegexp(stdout,
verboseExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
expectedMessage)
@@ -1077,7 +1077,7 @@ var _ = Describe("logger/log tests", func() {
Context("Custom with shell as info and file as error",
func() {
It("prints to stdout and the log file", func() {
expectedMessage := "debug custom"
- gplog.Custom(gplog.LOGERROR,
gplog.LOGINFO, expectedMessage)
+ gplog.Custom(gplog.LOGERROR,
gplog.LOGINFO, "%s", expectedMessage)
testhelper.ExpectRegexp(stdout,
expectedMessage)
testhelper.NotExpectRegexp(stdout,
infoExpected+expectedMessage)
testhelper.NotExpectRegexp(stderr,
expectedMessage)
diff --git a/structmatcher/structmatcher.go b/structmatcher/structmatcher.go
index 6431903..b441ec0 100644
--- a/structmatcher/structmatcher.go
+++ b/structmatcher/structmatcher.go
@@ -57,8 +57,8 @@ func structMatcher(expected, actual reflect.Value, fieldPath
string, shouldFilte
expectedFieldIsNonemptySlice := expectedField.Kind() ==
reflect.Slice && !expectedField.IsNil() && expectedField.Len() > 0
fieldIsStructSlice := actualFieldIsNonemptySlice &&
expectedFieldIsNonemptySlice && actualField.Len() == expectedField.Len() &&
actualField.Index(0).Kind() == reflect.Struct
- expectedFieldIsNilPtr := expectedStruct.Field(i).Kind()
== reflect.Ptr && expectedStruct.Field(i).IsNil()
- actualFieldIsNilPtr := actualStruct.Field(i).Kind() ==
reflect.Ptr && actualStruct.Field(i).IsNil()
+ expectedFieldIsNilPtr := expectedStruct.Field(i).Kind()
== reflect.Pointer && expectedStruct.Field(i).IsNil()
+ actualFieldIsNilPtr := actualStruct.Field(i).Kind() ==
reflect.Pointer && actualStruct.Field(i).IsNil()
if fieldIsStructSlice {
for j := 0; j < actualField.Len(); j++ {
diff --git a/structmatcher/structmatcher_test.go
b/structmatcher/structmatcher_test.go
index f2eb5c4..e1e0e6d 100644
--- a/structmatcher/structmatcher_test.go
+++ b/structmatcher/structmatcher_test.go
@@ -211,12 +211,12 @@ var _ = Describe("structmatcher.StructMatcher", func() {
// uses reflect.Value.
type OpaqueStruct struct {
privateField string
- privateStructField SimpleStruct
+ privateStructField SimpleStruct //nolint:unused //
intentionally unused to test unexported field handling
}
type SemiOpaqueStruct struct {
PublicField SimpleStruct
privateField string
- privateStructField SimpleStruct
+ privateStructField SimpleStruct //nolint:unused //
intentionally unused to test unexported field handling
PublicField2 SimpleStruct
}
type NestedOpaqueStruct struct {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]