Skip to content

Commit 1f72d0a

Browse files
committed
add ci
1 parent 8267c5f commit 1f72d0a

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

.github/workflows/golang-ci.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: golang-ci
2+
3+
on:
4+
# Trigger the workflow on push or pull request,
5+
# but only for the main branch
6+
push:
7+
branches:
8+
- main
9+
- master
10+
pull_request:
11+
branches:
12+
- main
13+
- master
14+
# Allows you to run this workflow manually from the Actions tab
15+
workflow_dispatch:
16+
17+
jobs:
18+
lint:
19+
runs-on: ubuntu-latest
20+
container:
21+
image: golangci/golangci-lint:v1.54.0
22+
steps:
23+
- name: checkout
24+
uses: actions/checkout@v4
25+
- name: golangci-lint
26+
run: golangci-lint run --modules-download-mode=mod
27+
28+
build:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: checkout
32+
uses: actions/checkout@v4
33+
- name: Set up Go
34+
uses: actions/setup-go@v4
35+
with:
36+
go-version: 1.21
37+
- name: build broker
38+
run: go build -o chat-broker ./cmd/broker
39+
- name: build logic
40+
run: go build -o chat-logic ./cmd/logic

.golangci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
linters:
2+
disable-all: true
3+
enable:
4+
- errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases
5+
- gosimple # Linter for Go source code that specializes in simplifying a code
6+
- govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
7+
- ineffassign # Detects when assignments to existing variables are not used
8+
- staticcheck # Staticcheck is a go vet on steroids, applying a ton of static analysis checks
9+
- typecheck # Like the front-end of a Go compiler, parses and type-checks Go code
10+
- unused # Checks Go code for unused constants, variables, functions and types
11+
- exportloopref
12+
13+
linters-settings:
14+
govet:
15+
enable-all: true
16+
check-shadowing: true
17+
disable:
18+
- fieldalignment
19+
20+
run:
21+
skip-dirs:
22+
- scripts
23+
- test
24+
- example
25+
- cmd

0 commit comments

Comments
 (0)