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

Update minimum required Go version to 1.18 #348

Merged
merged 4 commits into from
Aug 13, 2022
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
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

strategy:
matrix:
go: [1.17, 1.18]
go: [1.18, 1.19]
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
Expand All @@ -40,11 +40,11 @@ jobs:
run: go test -v -tags migrationtest ./...

- name: Generate code coverage
if: matrix.os == 'ubuntu-latest' && matrix.go == '1.18'
if: matrix.os == 'ubuntu-latest' && matrix.go == '1.19'
run: go test -race -v -count=1 -coverprofile=coverage.out -tags test ./...

- name: Upload Test Coverage
if: matrix.os == 'ubuntu-latest' && matrix.go == '1.18'
if: matrix.os == 'ubuntu-latest' && matrix.go == '1.19'
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
Expand All @@ -67,17 +67,17 @@ jobs:

- uses: actions/download-artifact@v3
with:
name: chatterino-api-1.18-ubuntu-latest
name: chatterino-api-1.19-ubuntu-latest
path: bins/ubuntu/

- uses: actions/download-artifact@v3
with:
name: chatterino-api-1.18-macos-latest
name: chatterino-api-1.19-macos-latest
path: bins/macos/

- uses: actions/download-artifact@v3
with:
name: chatterino-api-1.18-windows-latest
name: chatterino-api-1.19-windows-latest
path: bins/windows/

- name: display structure
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

strategy:
matrix:
go: [1.17, 1.18]
go: [1.18, 1.19]

steps:
- name: Set up Go
Expand All @@ -27,7 +27,7 @@ jobs:
uses: actions/checkout@v3

- name: Install linter
run: go install honnef.co/go/tools/cmd/staticcheck
run: go install honnef.co/go/tools/cmd/staticcheck@v0.3.3

- name: Lint
run: staticcheck ./...
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.18 AS build
FROM golang:1.19 AS build
ADD . /src
RUN cd /src/cmd/api && GOOS=linux GOARCH=amd64 go build -tags netgo -ldflags '-extldflags "-static"'

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/Chatterino/api

go 1.17
go 1.18

require (
github.com/PuerkitoBio/goquery v1.8.0
Expand Down
117 changes: 0 additions & 117 deletions go.sum

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions internal/resolvers/betterttv/emote_loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"net/url"
"time"
Expand Down Expand Up @@ -86,7 +86,7 @@ func (l *EmoteLoader) Load(ctx context.Context, emoteHash string, r *http.Reques
}

// Read response into a string
body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
return resolver.Errorf("betterttv http body read error: %s", err)
}
Expand Down
5 changes: 2 additions & 3 deletions internal/resolvers/default/link_resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/http/httptest"
"net/url"
Expand Down Expand Up @@ -152,7 +151,7 @@ func TestLinkResolver(t *testing.T) {
router.ServeHTTP(respRec, test.inputReq)
resp := respRec.Result()
response := resolver.Response{}
bod, _ := ioutil.ReadAll(resp.Body)
bod, _ := io.ReadAll(resp.Body)
fmt.Println(string(bod))
// err := json.NewDecoder(resp.Body).Decode(&response)
err := json.Unmarshal([]byte(bod), &response)
Expand Down Expand Up @@ -267,7 +266,7 @@ func TestLinkResolver(t *testing.T) {
router.ServeHTTP(respRec, test.inputReq)
resp := respRec.Result()
response := resolver.Response{}
// bod, _ := ioutil.ReadAll(resp.Body)
// bod, _ := io.ReadAll(resp.Body)
// fmt.Println(string(bod))
err := json.NewDecoder(resp.Body).Decode(&response)
c.Assert(err, qt.IsNil)
Expand Down
4 changes: 2 additions & 2 deletions internal/resolvers/default/thumbnail_loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"net/url"
"strconv"
Expand Down Expand Up @@ -74,7 +74,7 @@ func (l *ThumbnailLoader) Load(ctx context.Context, urlString string, r *http.Re
return resolver.UnsupportedThumbnailType, nil, nil, cache.NoSpecialDur, nil
}

inputBuf, err := ioutil.ReadAll(resp.Body)
inputBuf, err := io.ReadAll(resp.Body)
if err != nil {
log.Errorw("Error reading body from request", "error", err)
return resolver.ErrorBuildingThumbnail, nil, nil, cache.NoSpecialDur, nil
Expand Down
4 changes: 2 additions & 2 deletions internal/resolvers/discord/invite_loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"net/url"
"strconv"
Expand Down Expand Up @@ -83,7 +83,7 @@ func (l *InviteLoader) Load(ctx context.Context, inviteCode string, r *http.Requ
}

// Read response into a string
body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
return &resolver.Response{
Status: http.StatusInternalServerError,
Expand Down
4 changes: 2 additions & 2 deletions internal/resolvers/oembed/facebook.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package oembed

import (
"encoding/json"
"io/ioutil"
"io"
"log"
"net/http"
"net/url"
Expand Down Expand Up @@ -35,7 +35,7 @@ func getFacebookAppAccessToken(appID string, appSecret string) (string, error) {

d := &facebookTokenResponse{}

bytes, err := ioutil.ReadAll(resp.Body)
bytes, err := io.ReadAll(resp.Body)
if err != nil {
log.Println("[oEmbed] error loading app access token", err)
return "", err
Expand Down
4 changes: 2 additions & 2 deletions internal/resolvers/oembed/initialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package oembed
import (
"context"
"html/template"
"io/ioutil"
"os"

"github.com/Chatterino/api/internal/db"
"github.com/Chatterino/api/internal/logger"
Expand All @@ -27,7 +27,7 @@ var (
func Initialize(ctx context.Context, cfg config.APIConfig, pool db.Pool, resolvers *[]resolver.Resolver) {
log := logger.FromContext(ctx)

data, err := ioutil.ReadFile(cfg.OembedProvidersPath)
data, err := os.ReadFile(cfg.OembedProvidersPath)

if err != nil {
log.Warnw("[oEmbed] No providers.json file found, won't do oEmbed parsing")
Expand Down
4 changes: 2 additions & 2 deletions internal/resolvers/seventv/data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package seventv

import (
"encoding/json"
"io/ioutil"
"io"
"net/http"
"net/http/httptest"

Expand Down Expand Up @@ -92,7 +92,7 @@ func testServer() *httptest.Server {

var q gqlQuery

xd, _ := ioutil.ReadAll(r.Body)
xd, _ := io.ReadAll(r.Body)
err := json.Unmarshal(xd, &q)
if err != nil {
panic(err)
Expand Down
4 changes: 2 additions & 2 deletions internal/resolvers/supinic/track_loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"net/url"
"strconv"
Expand Down Expand Up @@ -72,7 +72,7 @@ func (l *TrackLoader) Load(ctx context.Context, rawTrackID string, r *http.Reque
}

// Read response into a string
body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
return &resolver.Response{
Status: http.StatusInternalServerError,
Expand Down