Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go 1.19 にバージョンアップ #64

Merged
merged 5 commits into from
Jan 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@ jobs:
steps:
- uses: actions/setup-go@v2
with:
go-version: '1.16'
go-version: '1.19'
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.44.2
version: v1.50.1
test:
name: test
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/setup-go@v2
with:
go-version: '1.16'
go-version: '1.19'
- name: checkout
uses: actions/checkout@v3
- name: checkout migration repo
Expand All @@ -59,7 +59,7 @@ jobs:
run: |
go mod download
- name: run unit tests
run: go test -v -race -coverprofile coverage.out -covermode atomic $(go list ./... | grep -v /lgtm-cat-migration/)
run: go test -shuffle=on -v -race -coverprofile coverage.out -covermode atomic $(go list ./... | grep -v /lgtm-cat-migration/)
- name: upload coverage to Codecov
uses: codecov/codecov-action@v2
- name: run go mod tidy
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax = docker/dockerfile:1.3

FROM golang:1.16-alpine3.15 as base
FROM golang:1.19-alpine3.15 as base
LABEL maintainer="https://github.com/nekochans"
WORKDIR /go/app
ENV CGO_ENABLED=0
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ sqlc-generate:

.PHONY: lint
lint:
docker run --rm -v `pwd`:/app -w /app golangci/golangci-lint:v1.44.2 golangci-lint run -v
docker run --rm -v `pwd`:/app -w /app golangci/golangci-lint:v1.50.1 golangci-lint run -v

.PHONY: format
format:
docker run --rm -v `pwd`:/app -w /app golangci/golangci-lint:v1.44.2 golangci-lint run -v --fix
docker run --rm -v `pwd`:/app -w /app golangci/golangci-lint:v1.50.1 golangci-lint run -v --fix

.PHONY: run-normal-build
run-normal-build:
Expand Down
10 changes: 9 additions & 1 deletion cmd/local/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"log"
"net/http"
"time"

"github.com/aws/aws-sdk-go-v2/feature/s3/manager"
_ "github.com/go-sql-driver/mysql"
Expand All @@ -21,7 +22,14 @@ func main() {
logger = infrastructure.NewLogger()

r := handler.NewRouter(uploader, queries, logger)
err := http.ListenAndServe(":3333", r)

const timeoutSecond = 10
server := &http.Server{
Addr: ":3333",
Handler: r,
ReadHeaderTimeout: timeoutSecond * time.Second,
}
err := server.ListenAndServe()
if err != nil {
log.Println(err)
return
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ services:
target: unit-test
volumes:
- ./:/go/app
command: go test -v ./...
command: go test -shuffle=on -v ./...
environment:
TEST_DB_HOST: ${TEST_DB_HOST}
TEST_DB_USER: ${TEST_DB_USER}
Expand Down
17 changes: 16 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/nekochans/lgtm-cat-api

go 1.16
go 1.19

require (
github.com/aws/aws-lambda-go v1.24.0
Expand All @@ -16,3 +16,18 @@ require (
github.com/google/uuid v1.3.0
go.uber.org/zap v1.17.0
)

require (
github.com/aws/aws-sdk-go-v2/credentials v1.2.1 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.1.1 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.0.0 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.1.0 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.1.1 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.4.0 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.2.1 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.4.1 // indirect
github.com/aws/smithy-go v1.4.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
)
2 changes: 0 additions & 2 deletions usecase/fetchlgtmimages/usecase_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ var cdnDomain = "lgtm-images.lgtmeow.com"

var testDb *sql.DB

// Go1.15 から TestMain には os.Exit() のコールが不要になったのでlintのルールを無効化
//nolint:staticcheck
func TestMain(m *testing.M) {
dbCreator := &test.DbCreator{}
var err error
Expand Down