Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
szpnygo committed Oct 12, 2022
0 parents commit 897bc1d
Show file tree
Hide file tree
Showing 46 changed files with 6,749 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "gomod" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
34 changes: 34 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: release

on:
push:
tags: ['v*.*.*']

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.19

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
if: startsWith(github.ref, 'refs/tags/v')
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
gtc.log
gtc
108 changes: 108 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
run:
go: '1.19'
timeout: 30m
skip-dirs:
- .cache
- gocui
skip-files:
- ".*pb\\.go"
tests: false

issues:
max-same-issues: 200

linters:
disable-all: true
enable:
# 必须
- errcheck
- govet
- ineffassign
- staticcheck
- bodyclose
- durationcheck
- exportloopref
- gomodguard
- depguard
- gosec

# 建议
- gosimple
- decorder
- dogsled
- errchkjson
- errorlint
- goprintffuncname
- makezero
- misspell
- nakedret
- nestif
- nilerr # 后期建议放入,所有err均需要有处理
- nilnil
- noctx
- unconvert
linters-settings:
gosec:
excludes:
- G401
- G505
- G501
- G402
- G204
- G101
- G107
- G114

gosimple:
go: "1.19"
checks: ["all", "-SA1019", "-S1039", "-S1025", "-S1008"]
staticcheck:
go: "1.19"
checks: ["all", "-SA5008", "-SA9003", "-SA1029", "-SA4006"]
errcheck:
check-type-assertions: true
check-blank: false
revie:
enable-all-rules: true
ignore-generated-header: true
rules:
- name: var-naming
disabled: true
govet:
disable-all: true
enable:
- asmdecl
- assign
- atomic
- atomicalign
- bools
- buildtag
- cgocall
- composites
- copylocks
- deepequalerrors
- errorsas
- findcall
- framepointer
- httpresponse
- ifaceassert
- loopclosure
- lostcancel
- nilfunc
- nilness
- printf
- reflectvaluecompare
# - shadow
- shift
- sigchanyzer
- sortslice
- stdmethods
- stringintconv
- structtag
- testinggoroutine
- tests
- unmarshal
- unreachable
- unsafeptr
- unusedresult
# - unusedwrite
47 changes: 47 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
project_name: gtc

before:
hooks:
- go mod tidy
- go generate ./...

builds:
- env:
- CGO_ENABLED=0
ldflags:
- -s -w -X main.Version={{ .Version }}
goos:
- linux
- windows
- darwin

archives:
- replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
format: tar.gz
format_overrides:
- goos: windows
format: zip

checksum:
name_template: 'checksums.txt'

snapshot:
name_template: '{{ incpatch .Version }}'

changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
- '^ci:'

dockers:
- image_templates:
- 'neosu/{{ .ProjectName }}:{{ .Version }}'
- 'neosu/{{ .ProjectName }}:latest'
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM alpine

WORKDIR /app
COPY gtc /app/gtc

CMD ["/app/gtc"]
Loading

0 comments on commit 897bc1d

Please sign in to comment.