├── go.mod ├── README.md ├── main.go ├── .gitignore ├── .github └── workflows │ └── linter.yml ├── LICENSE └── .golangci.yaml /go.mod: -------------------------------------------------------------------------------- 1 | module golang-project-template 2 | 3 | go 1.18 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # golang-project-template 2 | Use it as a baseline for your Golang projects 3 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | ) 7 | 8 | func main() { 9 | fmt.Println("I am ", os.Args[0]) 10 | } 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | 8 | # Test binary, built with `go test -c` 9 | *.test 10 | 11 | # Output of the go coverage tool, specifically when used with LiteIDE 12 | *.out 13 | 14 | # Dependency directories (remove the comment below to include it) 15 | # vendor/ 16 | -------------------------------------------------------------------------------- /.github/workflows/linter.yml: -------------------------------------------------------------------------------- 1 | name: Linter 2 | 3 | on: 4 | push: 5 | tags: 6 | - v* 7 | branches: 8 | - master 9 | - main 10 | pull_request: 11 | workflow_dispatch: 12 | 13 | jobs: 14 | golangci: 15 | uses: TykTechnologies/github-actions/.github/workflows/golangci.yaml@main 16 | sonarcloud: 17 | needs: golangci 18 | uses: TykTechnologies/github-actions/.github/workflows/sonarcloud.yaml@main 19 | with: 20 | exclusions: "" 21 | secrets: inherit 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Tyk Technologies 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.golangci.yaml: -------------------------------------------------------------------------------- 1 | issues: 2 | exclude: 3 | - "^exported: exported var Err[A-Za-z0-9]+ should have comment or be unexported$" 4 | - "shadow: declaration of .err. shadows declaration" 5 | 6 | # Excluding configuration per-path, per-linter, per-text and per-source 7 | exclude-rules: 8 | # Exclude some linters from running on test files. 9 | - path: _test\.go 10 | linters: 11 | - dupl 12 | 13 | # Show only new issues created since branching away from default branch on the remote 14 | new-from-rev: origin/ 15 | 16 | linters: 17 | enable: 18 | - bodyclose 19 | - dupl 20 | - errcheck 21 | - gocritic 22 | - gofmt 23 | - gofumpt 24 | - goimports 25 | - govet 26 | - gosec 27 | - ineffassign 28 | - lll 29 | - misspell 30 | - revive 31 | - staticcheck 32 | - whitespace 33 | - wsl 34 | 35 | linters-settings: 36 | dupl: 37 | # tokens count to trigger issue, 150 by default 38 | threshold: 100 39 | 40 | errcheck: 41 | # Report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`. 42 | check-blank: true 43 | 44 | # Report about not checking of errors in type assertions: `a := b.(MyStruct)`. 45 | check-type-assertions: true 46 | 47 | gocritic: 48 | # See https://go-critic.github.io/overview#checks-overview 49 | # To check which checks are enabled run `GL_DEBUG=gocritic golangci-lint run` 50 | enabled-tags: 51 | - performance 52 | 53 | gofmt: 54 | # Simplify code with '-s' option 55 | simplify: true 56 | 57 | gofumpt: 58 | # Choose whether or not to use the extra rules that are disabled by default 59 | extra-rules: true 60 | 61 | # Select the Go version to target. 62 | lang-version: "1.17" 63 | 64 | goimports: 65 | # Put imports beginning with prefixes after 3rd-party packages; it's a comma-separated list of prefixes 66 | local-prefixes: "" 67 | 68 | govet: 69 | # Report about shadowed variables 70 | check-shadowing: true 71 | enable-all: true 72 | 73 | lll: 74 | # Max line length; lines longer will be reported 75 | # '\t' is counted as 1 character by default, and can be changed with the 'tab-width' option 76 | line-length: 120 77 | # Tab width in spaces 78 | tab-width: 2 79 | 80 | misspell: 81 | # Correct spellings using locale preferences for US or UK. 82 | # Default is to use a neutral variety of English. 83 | # Setting locale to US will correct the British spelling of 'colour' to 'color'. 84 | 85 | # Intentionally leaving this unset as most engineering terminology skews US however Tyk standard is UK. 86 | #locale: UK 87 | 88 | ignore-words: [] 89 | 90 | staticcheck: 91 | # https://staticcheck.io/docs/options#checks 92 | checks: ["all"] 93 | # Select the Go version to target. 94 | go: "1.17" 95 | 96 | whitespace: 97 | multi-if: false # Enforces newlines (or comments) after every multi-line if statement 98 | multi-func: false # Enforces newlines (or comments) after every multi-line function signature 99 | 100 | wsl: 101 | # Controls if you may cuddle assignments and anything without needing an empty line between them. 102 | allow-assign-and-anything: false 103 | # Allow calls and assignments to be cuddled as long as the lines have any matching variables, fields or types. 104 | # Default is true. 105 | allow-assign-and-call: true 106 | # Controls if you may end case statements with a whitespace. 107 | allow-case-trailing-whitespace: true 108 | # Allow declarations (var) to be cuddled. 109 | allow-cuddle-declarations: true 110 | # Allow multiline assignments to be cuddled. Default is true. 111 | allow-multiline-assign: true 112 | # This option allows whitespace after each comment group that begins a block. 113 | allow-separated-leading-comment: false 114 | # Allow trailing comments in ending of blocks 115 | allow-trailing-comment: false 116 | # Enforces that an if statement checking an error variable is cuddled with the line that assigned that error variable. 117 | enforce-err-cuddling: true 118 | # Force newlines in end of case at this limit (0 = never). 119 | force-case-trailing-whitespace: 0 120 | # Enforces that an assignment which is actually a short declaration (using :=) is only allowed to cuddle with other short declarations, and not plain assignments, blocks, etc. 121 | force-short-decl-cuddling: false 122 | # Append is only allowed to be cuddled if appending value is matching variables, fields or types on line above. 123 | # Default is true. 124 | strict-append: true 125 | 126 | run: 127 | timeout: 10m 128 | build-tags: [] 129 | skip-dirs: [] 130 | --------------------------------------------------------------------------------