From 79813ccd6dab8d514593c1381369e466a6655f3a Mon Sep 17 00:00:00 2001 From: Sergey Vilgelm Date: Fri, 1 Oct 2021 12:57:20 -0700 Subject: [PATCH] use Go v1.17 (#12) --- .github/workflows/checks.yaml | 25 ++++--------------------- .github/workflows/release.yaml | 2 +- .golangci.yml | 1 - Makefile | 6 +----- README.md | 15 +++++++-------- 5 files changed, 13 insertions(+), 36 deletions(-) diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index 02b77fe..c43ced9 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -11,18 +11,19 @@ on: - cron: "0 0 * * 0" env: - GO: 1.16 + GO: 1.17 jobs: CodeQL: - # CodeQL runs on ubuntu-latest, windows-latest, and macos-latest runs-on: ubuntu-latest + permissions: + security-events: write + steps: - name: Checkout repository uses: actions/checkout@v2 - # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@v1 with: @@ -69,21 +70,3 @@ jobs: version: latest skip-build-cache: true skip-go-installation: true - - Nancy: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Install Go - uses: actions/setup-go@v2 - with: - go-version: ${{ env.GO }} - - - name: Prepare go list - run: go list -json -m all > go.list - - - name: Run Nancy - uses: sonatype-nexus-community/nancy-github-action@v1.0.2 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 55a2617..a58ebdd 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -8,7 +8,7 @@ on: - "v[0-9]+.[0-9]+.[0-9]+" env: - GO: 1.16 + GO: 1.17 jobs: bump-version: diff --git a/.golangci.yml b/.golangci.yml index 13bf8d9..7754968 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -16,7 +16,6 @@ linters: - gocyclo - goerr113 - gofumpt - - golint - goprintffuncname - gosec - ifshort diff --git a/Makefile b/Makefile index 2ddc673..0c0b8eb 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ ifeq ($(shell uname), Darwin) all: brew-install endif -all: tidy lint nancy test done +all: tidy lint test done done: @echo "$(OK_COLOR)==> Done.$(NO_COLOR)" @@ -26,10 +26,6 @@ run-benchmark: test: run-test run-benchmark -nancy: - @echo "$(OK_COLOR)==> Checking Vulnerability via nancy...$(NO_COLOR)" - @go list -json -m all | nancy sleuth --quiet - lint: @echo "$(OK_COLOR)==> Linting via golangci-lint...$(NO_COLOR)" @golangci-lint run --fix ./... diff --git a/README.md b/README.md index 4e0ac3d..724654d 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ The small library with an implementation of Buffer Pool. The library was created to avoid repeating this code. -Here is a good article how to use implement and properly use the Buffer Pools: https://www.captaincodeman.com/2017/06/02/golang-buffer-pool-gotcha +Here is a good article how to implement and properly use the Buffer Pools: https://www.captaincodeman.com/2017/06/02/golang-buffer-pool-gotcha ## Usage @@ -16,14 +16,14 @@ package main import ( "fmt" - "sync" + "sync" "text/template" buffferspool "github.com/sv-tools/buffers-pool" ) -func render(template string, data interface{}) (string, error) { - tmpl, err := template.New("test").Parse(template) +func render(tmpl string, data interface{}) (string, error) { + tp, err := template.New("test").Parse(tmpl) if err != nil { return "", err } @@ -31,7 +31,7 @@ func render(template string, data interface{}) (string, error) { buf := buffferspool.Get() defer buffferspool.Put(buf) - if err := tmpl.Execute(buf, data); err != nil { + if err := tp.Execute(buf, data); err != nil { return "", err } @@ -39,7 +39,7 @@ func render(template string, data interface{}) (string, error) { } func main() { - var template string + var tmpl string var data []interface{} // ... load template and data to variables ... @@ -49,7 +49,7 @@ func main() { wg.Add(1) go func(data interface{}) { defer wg.Done() - val, err := render(data) + val, err := render(tmpl, data) if err != nil { res <- err.Error() return @@ -69,7 +69,6 @@ func main() { } ``` - ## License MIT licensed. See the bundled [LICENSE](LICENSE) file for more details.