From e341e79a10134cf561fb0da0ef4e32d39c0ec99a Mon Sep 17 00:00:00 2001 From: Manuel Odendahl Date: Sun, 15 Dec 2024 21:30:40 +0100 Subject: [PATCH] Initial commit --- .github/workflows/lint.yml | 32 ++++++++++++ .github/workflows/push.yml | 23 +++++++++ .github/workflows/release.yml | 44 +++++++++++++++++ .gitignore | 21 ++++++++ .golangci.yml | 22 +++++++++ .goreleaser.yaml | 91 +++++++++++++++++++++++++++++++++++ LICENSE | 21 ++++++++ Makefile | 48 ++++++++++++++++++ README.md | 58 ++++++++++++++++++++++ cmd/XXX/main.go | 5 ++ lefthook.yml | 19 ++++++++ pkg/doc.go | 5 ++ 12 files changed, 389 insertions(+) create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/push.yml create mode 100644 .github/workflows/release.yml create mode 100644 .gitignore create mode 100644 .golangci.yml create mode 100644 .goreleaser.yaml create mode 100644 LICENSE create mode 100644 Makefile create mode 100644 README.md create mode 100644 cmd/XXX/main.go create mode 100644 lefthook.yml create mode 100644 pkg/doc.go diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..134ec67 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,32 @@ +# this is copied over from goreleaser/goreleaser/.github/workflows/lint.yml +name: golangci-lint +on: + push: + tags: + - v* + branches: + - main + pull_request: +permissions: + contents: read + +jobs: + golangci: + permissions: + contents: read + pull-requests: read + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - run: git fetch --force --tags + - uses: actions/setup-go@v3 + with: + go-version: '>=1.19.5' + cache: true + - name: golangci-lint + uses: golangci/golangci-lint-action@v3.1.0 + with: + args: --timeout=5m \ No newline at end of file diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 0000000..5788121 --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,23 @@ +name: golang-pipeline + +on: + push: + branches: + - 'main' + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - run: git fetch --force --tags + - uses: actions/setup-go@v3 + with: + go-version: '>=1.19.5' + cache: true + - + name: Run unit tests + run: go test ./... diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..071fc4c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,44 @@ +on: + push: + # run only against tags + tags: + - '*' + +permissions: + contents: write + # packages: write + # issues: write + + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - run: git fetch --force --tags + - uses: actions/setup-go@v3 + with: + go-version: '>=1.19.5' + cache: true + + - name: Import GPG key + id: import_gpg + uses: crazy-max/ghaction-import-gpg@v5 + with: + gpg_private_key: ${{ secrets.GO_GO_GOLEMS_SIGN_KEY }} + passphrase: ${{ secrets.GO_GO_GOLEMS_SIGN_PASSPHRASE }} + fingerprint: "6EBE1DF0BDF48A1BBA381B5B79983EF218C6ED7E" + + - uses: goreleaser/goreleaser-action@v4 + with: + distribution: goreleaser + version: latest + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COSIGN_PWD: ${{ secrets.COSIGN_PWD }} + TAP_GITHUB_TOKEN: ${{ secrets.RELEASE_ACTION_PAT }} + GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} + FURY_TOKEN: ${{ secrets.FURY_TOKEN }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d52c0ac --- /dev/null +++ b/.gitignore @@ -0,0 +1,21 @@ +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, built with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Dependency directories (remove the comment below to include it) +# vendor/ +dist/ + +# misc files and directories +.env +.envrc +.history diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..b7b72ca --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,22 @@ +linters: + disable-all: false + enable: + # defaults + - errcheck + - gosimple + - govet + - ineffassign + - staticcheck + - typecheck + - unused + # stuff I'm adding + - exhaustive + # - gochecknoglobals + # - gochecknoinits + - gofmt + - nonamedreturns + - predeclared + fast: false +issues: + exclude: + - 'SA1019: cli.CreateProcessorLegacy' \ No newline at end of file diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..4ed1856 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,91 @@ +version: 2 +project_name: XXX + +before: + hooks: + # You may remove this if you don't use go modules. + - go mod tidy + # you may remove this if you don't need go generate + - go generate ./... +builds: + - env: + - CGO_ENABLED=0 + main: ./cmd/XXX + binary: XXX + goos: + - linux +# I am not able to test windows at the time +# - windows + - darwin +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ incpatch .Version }}-next" +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' + +signs: + - artifacts: checksum + # setup for github actions according to https://goreleaser.com/ci/actions/ + args: [ "--batch", "-u", "{{ .Env.GPG_FINGERPRINT }}", "--output", "${signature}", "--detach-sign", "${artifact}" ] + +brews: + - name: XXX + description: "XXX is a tool" + homepage: "https://github.com/go-go-golems/XXX" + repository: + owner: go-go-golems + name: homebrew-go-go-go + token: "{{ .Env.TAP_GITHUB_TOKEN }}" + +nfpms: + - + id: packages + + vendor: GO GO GOLEMS + homepage: https://github.com/go-go-golems/ + maintainer: Manuel Odendahl + + description: |- + XXX is a tool + + license: MIT + + # Formats to be generated. + formats: + # - apk + - deb + - rpm + + # Version Release. + release: 1 + + # Section. + section: default + + # Priority. + priority: extra + + # Custom configuration applied only to the Deb packager. + deb: + # Lintian overrides + lintian_overrides: + - statically-linked-binary + - changelog-file-missing-in-native-package + +publishers: + - name: fury.io + # by specifying `packages` id here goreleaser will only use this publisher + # with artifacts identified by this id + ids: + - packages + dir: "{{ dir .ArtifactPath }}" + cmd: curl -F package=@{{ .ArtifactName }} https://{{ .Env.FURY_TOKEN }}@push.fury.io/go-go-golems/ + +# modelines, feel free to remove those if you don't want/use them: +# yaml-language-server: $schema=https://goreleaser.com/static/schema.json +# vim: set ts=2 sw=2 tw=0 fo=cnqoj diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..1a4a2c4 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Manuel Odendahl + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..fc92bd5 --- /dev/null +++ b/Makefile @@ -0,0 +1,48 @@ +.PHONY: gifs + +all: gifs + +VERSION=v0.1.14 + +TAPES=$(shell ls doc/vhs/*tape) +gifs: $(TAPES) + for i in $(TAPES); do vhs < $$i; done + +docker-lint: + docker run --rm -v $(shell pwd):/app -w /app golangci/golangci-lint:v1.50.1 golangci-lint run -v + +lint: + golangci-lint run -v + +test: + go test ./... + +build: + go generate ./... + go build ./... + +goreleaser: + goreleaser release --skip=sign --snapshot --clean + +tag-major: + git tag $(shell svu major) + +tag-minor: + git tag $(shell svu minor) + +tag-patch: + git tag $(shell svu patch) + +release: + git push --tags + GOPROXY=proxy.golang.org go list -m github.com/go-go-golems/XXX@$(shell svu current) + +bump-glazed: + go get github.com/go-go-golems/glazed@latest + go get github.com/go-go-golems/clay@latest + go mod tidy + +XXX_BINARY=$(shell which XXX) +install: + go build -o ./dist/XXX ./cmd/XXX && \ + cp ./dist/XXX $(XXX_BINARY) diff --git a/README.md b/README.md new file mode 100644 index 0000000..a7d6cf9 --- /dev/null +++ b/README.md @@ -0,0 +1,58 @@ +# GO GO TEMPLATE + +``` + _______ _______ _______ _______ +| || | | || | +| ___|| _ | | ___|| _ | +| | __ | | | | | | __ | | | | +| || || |_| | | || || |_| | +| |_| || | | |_| || | +|_______||_______| |_______||_______| + _______ _______ __ __ _______ ___ _______ _______ _______ +| || || |_| || || | | _ || || | +|_ _|| ___|| || _ || | | |_| ||_ _|| ___| + | | | |___ | || |_| || | | | | | | |___ + | | | ___|| || ___|| |___ | | | | | ___| + | | | |___ | ||_|| || | | || _ | | | | |___ + |___| |_______||_| |_||___| |_______||__| |__| |___| |_______| +``` + +--- + +``` + _______ _______ _______ _______ +| || | | || | +| ___|| _ | | ___|| _ | +| | __ | | | | | | __ | | | | +| || || |_| | | || || |_| | +| |_| || | | |_| || | +|_______||_______| |_______||_______| + _______ _______ ___ _______ __ __ _______ +| || || | | || |_| || | +| ___|| _ || | | ___|| || _____| +| | __ | | | || | | |___ | || |_____ +| || || |_| || |___ | ___|| ||_____ | +| |_| || || || |___ | ||_|| | _____| | +|_______||_______||_______||_______||_| |_||_______| + __ __ _______ ___ _ _______ __ __ _______ ______ _______ +| |_| || _ || | | || | | |_| || || _ | | | +| || |_| || |_| || ___| | || _ || | || | ___| +| || || _|| |___ | || | | || |_|| | |___ +| || || |_ | ___| | || |_| || __ || ___| +| ||_|| || _ || _ || |___ | ||_|| || || | ||| |___ +|_| |_||__| |__||___| |_||_______| |_| |_||_______||___| |||_______| + _______ _______ _______ _______ +| || | | || | +| ___|| _ | | ___|| _ | +| | __ | | | | | | __ | | | | +| || || |_| | | || || |_| | +| |_| || | | |_| || | +|_______||_______| |_______||_______| + _______ _______ ___ _______ __ __ _______ +| || || | | || |_| || | +| ___|| _ || | | ___|| || _____| +| | __ | | | || | | |___ | || |_____ +| || || |_| || |___ | ___|| ||_____ | +| |_| || || || |___ | ||_|| | _____| | +|_______||_______||_______||_______||_| |_||_______| +``` diff --git a/cmd/XXX/main.go b/cmd/XXX/main.go new file mode 100644 index 0000000..ee8a161 --- /dev/null +++ b/cmd/XXX/main.go @@ -0,0 +1,5 @@ +package main + +func main() { + +} \ No newline at end of file diff --git a/lefthook.yml b/lefthook.yml new file mode 100644 index 0000000..e82af58 --- /dev/null +++ b/lefthook.yml @@ -0,0 +1,19 @@ +pre-commit: + commands: + lint: + glob: '*.go' + run: make lint + test: + glob: '*.go' + run: make test + parallel: true + +pre-push: + commands: + release: + run: make goreleaser + lint: + run: make lint + test: + run: make test + parallel: true diff --git a/pkg/doc.go b/pkg/doc.go new file mode 100644 index 0000000..0fc01a9 --- /dev/null +++ b/pkg/doc.go @@ -0,0 +1,5 @@ +package pkg + +func init() { + +}