-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
2 changed files
with
65 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,40 @@ | ||
name: golang-ci | ||
|
||
on: | ||
# Trigger the workflow on push or pull request, | ||
# but only for the main branch | ||
push: | ||
branches: | ||
- main | ||
- master | ||
pull_request: | ||
branches: | ||
- main | ||
- master | ||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: golangci/golangci-lint:v1.54.0 | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
- name: golangci-lint | ||
run: golangci-lint run --modules-download-mode=mod | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: 1.21 | ||
- name: build broker | ||
run: go build -o chat-broker ./cmd/broker | ||
- name: build logic | ||
run: go build -o chat-logic ./cmd/logic |
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,25 @@ | ||
linters: | ||
disable-all: true | ||
enable: | ||
- errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases | ||
- gosimple # Linter for Go source code that specializes in simplifying a code | ||
- govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string | ||
- ineffassign # Detects when assignments to existing variables are not used | ||
- staticcheck # Staticcheck is a go vet on steroids, applying a ton of static analysis checks | ||
- typecheck # Like the front-end of a Go compiler, parses and type-checks Go code | ||
- unused # Checks Go code for unused constants, variables, functions and types | ||
- exportloopref | ||
|
||
linters-settings: | ||
govet: | ||
enable-all: true | ||
check-shadowing: true | ||
disable: | ||
- fieldalignment | ||
|
||
run: | ||
skip-dirs: | ||
- scripts | ||
- test | ||
- example | ||
- cmd |