generated from vmyroslav/go-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 899172d
Showing
9 changed files
with
251 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Lint and Test | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
env: | ||
GO_VERSION: "1.22.x" | ||
|
||
jobs: | ||
lint: | ||
name: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: lint | ||
uses: golangci/golangci-lint-action@v3 | ||
|
||
test: | ||
name: test | ||
needs: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Go cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/go/pkg/mod | ||
~/.cache/go-build | ||
key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-cache-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go-${{ env.GO_VERSION }}-cache | ||
- name: Install Task | ||
uses: arduino/setup-task@v1 | ||
with: | ||
version: 3.x | ||
|
||
- name: Test | ||
run: task test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/.DS_Store | ||
/.idea/ | ||
|
||
/bin/* | ||
/.env | ||
|
||
/.serverless | ||
/terraform/.terraform.lock.hcl | ||
/terraform/.terraform/ | ||
/unit.coverprofile | ||
/credentials.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
run: | ||
go: '1.22' | ||
timeout: 5m | ||
|
||
linters-settings: | ||
errcheck: | ||
check-type-assertions: true | ||
govet: | ||
enable: | ||
- fieldalignment | ||
goconst: | ||
min-len: 2 | ||
min-occurrences: 2 | ||
misspell: | ||
locale: US | ||
lll: | ||
line-length: 140 | ||
gocritic: | ||
enabled-tags: | ||
- performance | ||
- style | ||
- experimental | ||
- opinionated | ||
|
||
linters: | ||
disable-all: true | ||
enable: | ||
- bodyclose | ||
- containedctx | ||
- copyloopvar | ||
- cyclop | ||
- dogsled | ||
- dupl | ||
- errcheck | ||
- errchkjson | ||
- errname | ||
- exhaustive | ||
- exportloopref | ||
- gas | ||
- gci | ||
- gochecknoinits | ||
- goconst | ||
- gocritic | ||
- gocyclo | ||
- gofmt | ||
- gosec | ||
- gosimple | ||
- govet | ||
- importas | ||
- ineffassign | ||
- interfacebloat | ||
- loggercheck | ||
- megacheck | ||
- mirror | ||
- misspell | ||
- nakedret | ||
- nestif | ||
- noctx | ||
- prealloc | ||
- reassign | ||
- revive | ||
- sloglint | ||
- staticcheck | ||
- stylecheck | ||
- tagliatelle | ||
- tenv | ||
- testifylint | ||
- thelper | ||
- tparallel | ||
- typecheck | ||
- unconvert | ||
- unparam | ||
- unused | ||
- whitespace | ||
- wrapcheck | ||
- wsl | ||
fast: false | ||
|
||
issues: | ||
exclude-rules: | ||
- text: "at least one file in a package should have a package comment" | ||
linters: | ||
- stylecheck | ||
- text: "should have a package comment" | ||
linters: | ||
- revive | ||
- text: "should have comment or be unexported" | ||
linters: | ||
- revive | ||
- text: "whyNoLint" | ||
linters: | ||
- gocritic | ||
- path: _test\.go | ||
linters: | ||
- gosec | ||
- dupl | ||
- cyclop | ||
- govet | ||
exclude-files: | ||
- "mock_.+\\.go" | ||
exclude-use-default: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
BUILD_DIR ?= out | ||
VENDOR_DIR = vendor | ||
|
||
GOLANGCI_LINT_VERSION ?= 1.55.1 | ||
|
||
GO ?= go | ||
GOLANGCI_LINT ?= golangci-lint | ||
|
||
all: clean | ||
.PHONY: all | ||
|
||
clean: | ||
@rm -f ./bin/* | ||
|
||
.PHONY: test | ||
test: test-unit | ||
|
||
## Run unit tests | ||
.PHONY: test-unit | ||
test-unit: | ||
@echo ">> Unit test" | ||
@$(GO) test -gcflags=-l -coverprofile=unit.coverprofile -covermode=atomic -race ./... | ||
|
||
lint: | ||
@echo ">> Linting" | ||
@$(GOLANGCI_LINT) run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[![Action Status](https://github.com/vmyroslav/go-template/actions/workflows/ci.yaml/badge.svg)](https://github.com/vmyroslav/go-template/actions/workflows/ci.yaml) | ||
|
||
# Project | ||
|
||
## List of useful commands: | ||
|
||
* `task help` - shows the list of all available commands | ||
|
||
### Prerequisites | ||
|
||
- Go version 1.22 or later | ||
- Taskfile for task running | ||
|
||
### Installing | ||
|
||
A step by step series of examples that tell you how to get a development environment running. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
version: '3' | ||
|
||
dotenv: ['.env'] # take variables from .env file | ||
|
||
env: | ||
OK_COLOR: '\033[32;01m' | ||
NO_COLOR: '\033[0m' | ||
|
||
tasks: | ||
default: | ||
cmds: | ||
- task --list-all | ||
lint: | ||
cmds: | ||
- golangci-lint run -c .golangci.yml | ||
test: | ||
cmds: | ||
- go test -gcflags=-l -covermode=atomic -race ./... | ||
update-deps: | ||
desc: Update dependencies | ||
cmds: | ||
- go get -u -d ./... | ||
fumpt: | ||
desc: Gofumpt project files | ||
cmds: | ||
- find . -name '*.go' -type f -exec gofumpt -w {} + |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module home-bartender-back | ||
|
||
go 1.22 | ||
|
||
require github.com/vmyroslav/home-lib v0.1.0 // indirect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
github.com/vmyroslav/home-lib v0.0.0-20231113100224-567b61697473 h1:k26CnMh1z7duzbKO8Pvw/jXHmJ2+R5w4G5kmRfXC86c= | ||
github.com/vmyroslav/home-lib v0.0.0-20231113100224-567b61697473/go.mod h1:+8aMxDeF9QZCA+r3lCnAd0o3V3oq7b5rTs5WhzNGTjE= | ||
github.com/vmyroslav/home-lib v0.1.0 h1:rd7AHHcbH5eWveW3XDfLh+6gDY/604dmJl7CNGQHzgM= | ||
github.com/vmyroslav/home-lib v0.1.0/go.mod h1:YqjLu07ymd+i53pztQXD43T8nrROg5CTe1eQyGTYbd8= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package main | ||
|
||
import "fmt" | ||
|
||
func main() { | ||
fmt.Println("Hello, playground") | ||
} |