diff --git a/.github/workflows/github-action.yml b/.github/workflows/pull_request.yml similarity index 64% rename from .github/workflows/github-action.yml rename to .github/workflows/pull_request.yml index aa5c46d..2056ecc 100644 --- a/.github/workflows/github-action.yml +++ b/.github/workflows/pull_request.yml @@ -1,4 +1,4 @@ -name: "CI" +name: "Lint code and run tests" on: pull_request: @@ -9,25 +9,27 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - go: [ '1.22.x', '1.23.x' ] + go: [ '1.23.x' ] steps: - - name: "Checking out code..." + - name: "Check out code" uses: actions/checkout@v4 - - name: "Installing Go..." + - name: "Install Go" uses: WillAbides/setup-go-faster@v1 with: go-version: ${{ matrix.go }} - - name: "Install dependencies..." + - name: "Install dependencies" run: go mod download - - name: "Verifying dependencies..." + - name: "Tidy code" + run: go mod tidy -diff + - name: "Verify dependencies" run: go mod verify - - name: "Vetting code..." + - name: "Vet code" run: go vet ./... - uses: dominikh/staticcheck-action@v1 with: version: "latest" install-go: false cache-key: ${{ matrix.go }} - - name: "Running tests..." + - name: "Run tests" run: go test -race -vet=off ./... diff --git a/Dockerfile b/Dockerfile index c3e3d27..d18d9b4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.22-bullseye AS build +FROM golang:1.23-bullseye AS build WORKDIR /app COPY go.mod go.sum ./ RUN go mod download diff --git a/go.mod b/go.mod index 50808c8..3a733d3 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/rynhndrcksn/go-starter-site -go 1.22 +go 1.23 require ( github.com/alexedwards/scs/pgxstore v0.0.0-20240316134038-7e11d57e8885 @@ -13,7 +13,7 @@ require ( github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect github.com/jackc/puddle/v2 v2.2.2 // indirect - golang.org/x/crypto v0.28.0 // indirect - golang.org/x/sync v0.8.0 // indirect - golang.org/x/text v0.19.0 // indirect + golang.org/x/crypto v0.30.0 // indirect + golang.org/x/sync v0.10.0 // indirect + golang.org/x/text v0.21.0 // indirect ) diff --git a/go.sum b/go.sum index 5030bdd..04027f2 100644 --- a/go.sum +++ b/go.sum @@ -43,6 +43,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= +golang.org/x/crypto v0.30.0 h1:RwoQn3GkWiMkzlX562cLB7OxWvjH1L8xutO2WoJcRoY= +golang.org/x/crypto v0.30.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -55,6 +57,8 @@ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -76,6 +80,8 @@ golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= diff --git a/makefile b/makefile index 820484f..1957f1f 100644 --- a/makefile +++ b/makefile @@ -61,24 +61,30 @@ db/mig/up: confirm .PHONY: audit audit: @echo 'Checking module dependencies' - @#go mod tidy -diff | only applicable in Go 1.23 and later - go mod verify + @go mod tidy -diff + @go mod verify @echo 'Vetting code...' - go vet ./... - staticcheck ./... + @go vet ./... + @staticcheck ./... @echo 'Running tests...' - go test -race -vet=off ./... + @go test -race -vet=off ./... ## tidy: format all .go files and tidy module dependencies .PHONY: tidy tidy: @echo 'Formatting .go files...' - go fmt ./... + @go fmt ./... @echo 'Tidying module dependencies...' - go mod tidy + @go mod tidy @echo 'Verifying and vendoring module dependencies...' - go mod verify - go mod vendor + @go mod verify + @go mod vendor + +## up: update all dependencies in go.mod +.PHONY: up +up: + @echo 'Updating dependencies...' + @go get -u ./... ## test: run all the tests .PHONY: test