Skip to content

Commit 37ac3e5

Browse files
committed
Remove bin files and add go tool
1 parent d4a2fef commit 37ac3e5

16 files changed

Lines changed: 220 additions & 111 deletions

File tree

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

.github/workflows/bin/gofumpt

-6.01 MB
Binary file not shown.

.github/workflows/bin/govulncheck

-14.4 MB
Binary file not shown.

.github/workflows/bin/staticcheck

-15.1 MB
Binary file not shown.

.github/workflows/bin/swag

-18.2 MB
Binary file not shown.

.github/workflows/build.yml

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,38 +13,31 @@ jobs:
1313
GOEXPERIMENT: jsonv2
1414

1515
steps:
16-
- name: Setup Go
17-
uses: actions/setup-go@v5
18-
with:
19-
go-version: '1.26.0-rc.2'
20-
2116
- name: Checkout code
22-
uses: actions/checkout@v4
17+
uses: actions/checkout@v6
2318

24-
- name: go mod package cache
25-
uses: actions/cache@v4
19+
- name: Setup Go
20+
uses: actions/setup-go@v6
2621
with:
27-
path: |
28-
~/.cache/go-build
29-
~/go/pkg/mod
30-
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
31-
restore-keys: |
32-
${{ runner.os }}-go-
22+
go-version: '>=1.26.4'
3323

34-
- name: Tests
35-
run: go test ./...
24+
- name: Install Tools
25+
run: go install tool
3626

3727
- name: Gofumpt
38-
run: ./.github/workflows/bin/gofumpt -l -w . 2>&1 | tee outfile && test -z "$(cat outfile)" && rm outfile
28+
run: go tool gofumpt -d -e .
3929

4030
- name: Go Vet
4131
run: go vet ./...
4232

4333
- name: Staticcheck
44-
run: ./.github/workflows/bin/staticcheck ./...
34+
run: go tool staticcheck ./...
4535

4636
- name: Govulncheck
47-
run: ./.github/workflows/bin/govulncheck ./...
37+
run: go tool govulncheck ./...
4838

4939
- name: OpenAPI specification errors
50-
run: ./.github/workflows/bin/swag init -g cmd/app/main.go -o . -ot yaml --v3.1 --parseDependency
40+
run: go tool swag init -g cmd/app/main.go -o . -ot yaml --v3.1 --parseDependency && mv swagger.yaml openapi-v3.yaml && git diff --exit-code openapi-v3.yaml
41+
42+
- name: Tests
43+
run: go test ./...

.github/workflows/release.yml

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,46 +12,36 @@ jobs:
1212
GOEXPERIMENT: jsonv2
1313

1414
steps:
15-
- name: Setup Go
16-
uses: actions/setup-go@v5
17-
with:
18-
go-version: '1.26.0-rc.2'
19-
2015
- name: Checkout code
21-
uses: actions/checkout@v4
16+
uses: actions/checkout@v6
2217

23-
- name: go mod package cache
24-
uses: actions/cache@v4
18+
- name: Setup Go
19+
uses: actions/setup-go@v6
2520
with:
26-
path: |
27-
~/.cache/go-build
28-
~/go/pkg/mod
29-
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
30-
restore-keys: |
31-
${{ runner.os }}-go-
21+
go-version: '1.26.x'
3222

3323
- name: Upload OpenAPI specifications to release
3424
uses: svenstaro/upload-release-action@v2
3525
with:
3626
repo_token: ${{ github.token }}
37-
file: openapi-v3.yml
27+
file: openapi-v3.yaml
3828
asset_name: myapp-${{ github.ref_name }}.openapi-v3.yaml
3929
tag: ${{ github.ref }}
4030

4131
- name: Setup Docker Buildx
4232
id: buildx
43-
uses: docker/setup-buildx-action@v3
33+
uses: docker/setup-buildx-action@v4
4434

4535
- name: Login to GitHub Container Registry
46-
uses: docker/login-action@v3
36+
uses: docker/login-action@v4
4737
with:
4838
registry: ghcr.io
4939
username: ${{ github.actor }}
5040
password: ${{ github.token }}
5141

5242
- name: Docker meta
5343
id: meta
54-
uses: docker/metadata-action@v5
44+
uses: docker/metadata-action@v6
5545
with:
5646
images: ghcr.io/learning-cloud-native-go/myapp
5747

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.26rc2-alpine
1+
FROM golang:1.26-alpine
22
WORKDIR /myapp
33

44
ENV GOEXPERIMENT=jsonv2

Justfile

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ db_host := "localhost"
88
help:
99
@just --list --unsorted --list-heading $'🚀MYAPP\n'
1010

11+
# Install development tools
12+
install:
13+
go install tool
14+
1115
# Run a specific cmd (defaults to app)
1216
go-run cmd="app":
1317
@export $(grep -v '^#' .env | xargs) && \
@@ -34,10 +38,10 @@ down:
3438

3539
# Run lints using gofumpt, go vet, staticcheck and govulncheck
3640
lint:
37-
gofumpt -l -w . 2>&1 | tee outfile && test -z "$(cat outfile)" && rm outfile
41+
go tool gofumpt -d -e .
3842
go vet ./...
39-
staticcheck ./...
40-
govulncheck ./...
43+
go tool staticcheck ./...
44+
go tool govulncheck ./...
4145

4246
# Run tests
4347
test:
@@ -49,8 +53,8 @@ gen:
4953

5054
# Generate openapi v3 specification using swag v2
5155
gen-openapi:
52-
swag init -g cmd/app/main.go -o . -ot yaml --v3.1 --parseDependency && mv swagger.yaml openapi-v3.yml
56+
go tool swag init -g cmd/app/main.go -o . -ot yaml --v3.1 --parseDependency && mv swagger.yaml openapi-v3.yaml
5357

5458
# Generate gorm repositories using gorm cli
5559
gen-gorm-repos:
56-
gorm gen -i ./app/book/repository.go -o ./app/book/bookrepo
60+
go tool gorm gen -i ./app/book/repository.go -o ./app/book/bookrepo

README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,18 @@
1313
- Use of GitHub Actions to run linters and tests, and to build and push production images to the registry.
1414
- Use of GitOps with ArgoCD to automate declarative environment orchestration and application lifecycle management.
1515

16-
> 💡 Go v1.26rc2 for json/v2 and new compiler features.
17-
18-
| Environment | Go 1.26rc2 Image Size | Postgres v18 Image Size |
19-
|----------------|-----------------------|-------------------------|
20-
| Development | 777 MB | 300MB |
21-
| Production | 30 MB | |
16+
| Environment | Go 1.26 Image Size | Postgres v18 Image Size |
17+
|----------------|--------------------|-------------------------|
18+
| Development | 800 MB | 300MB |
19+
| Production | 30 MB | |
2220

2321
## 📟 Available Commands
2422

2523
```just
2624
$ just
2725
🚀MYAPP
2826
help # List available commands
27+
install # Install development tools
2928
go-run cmd="app" # Run a specific cmd (defaults to app)
3029
go-run-migrate cmd="up" # Run database migrations (defaults to up)
3130
build # Run docker compose build
@@ -118,7 +117,7 @@ app-1 | {"level":"info","request_id":"d5mqjmhqvtmc73foh3dg","received_time":"20
118117
├── compose.yml
119118
├── Dockerfile
120119
121-
├── openapi-v3.yml
120+
├── openapi-v3.yaml
122121
123122
├── app
124123
│ ├── book

0 commit comments

Comments
 (0)