Skip to content

Commit

Permalink
ref: Add support for 1.18 in CI and make required changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilogorek committed Apr 21, 2022
1 parent d67b699 commit 335847c
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 42 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
pull_request:
branches: [master]
schedule:
- cron: '27 15 * * 2'
- cron: "27 15 * * 2"

jobs:
analyze:
Expand All @@ -17,16 +17,16 @@ jobs:
security-events: write

steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkout repository
uses: actions/checkout@v3

- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: go
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: go

- name: Autobuild
uses: github/codeql-action/autobuild@v1
- name: Autobuild
uses: github/codeql-action/autobuild@v1

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
10 changes: 4 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ jobs:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v2
with:
go-version: "1.17"
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
uses: golangci/golangci-lint-action@v3
with:
version: v1.45.2
version: v1.45
only-new-issues: true
timeout-minutes: 10
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ on:
jobs:
release:
runs-on: ubuntu-latest
name: 'Release a new version'
name: "Release a new version"
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
token: ${{ secrets.GH_RELEASE_PAT }}
fetch-depth: 0
Expand Down
22 changes: 10 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ jobs:
GO111MODULE: "on"
GOFLAGS: "-mod=readonly"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- uses: actions/checkout@v3
- uses: actions/cache@v2
with:
# In order:
Expand All @@ -38,16 +41,13 @@ jobs:
restore-keys: |
${{ runner.os }}-go-${{ matrix.go }}-
${{ runner.os }}-go-
- uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}
- name: Build
run: go build ./...
- name: Vet
run: go vet ./...
- name: Check go.mod Tidiness
run: go mod tidy -go=1.17 -compat=1.15 && git diff --exit-code
if: ${{ matrix.go == '1.17' }}
run: go mod tidy -go=1.18 -compat=1.16 && git diff --exit-code
if: ${{ matrix.go == '1.18' }}
- name: Test
run: go test -count=1 ./...
- name: Test (race)
Expand All @@ -56,11 +56,11 @@ jobs:
# pull requests, only run this step for a single job in the matrix. For
# all other workflow triggers (e.g., pushes to a release branch) run
# this step for the whole matrix.
if: ${{ github.event_name != 'pull_request' || (matrix.go == '1.17' && matrix.os == 'ubuntu') }}
if: ${{ github.event_name != 'pull_request' || (matrix.go == '1.18' && matrix.os == 'ubuntu') }}
timeout-minutes: 10
strategy:
matrix:
go: ["1.17", "1.16", "1.15"]
go: ["1.18", "1.17", "1.16"]
os: [ubuntu, windows, macos]
fail-fast: false
test-gopath:
Expand All @@ -77,7 +77,8 @@ jobs:
run:
working-directory: ${{ env.WORKDIR }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
- uses: actions/checkout@v3
with:
path: ${{ env.WORKDIR }}
# TODO: cache dependencies
Expand All @@ -94,9 +95,6 @@ jobs:
# key: gopath-${{ github.ref }}
# restore-keys: |
# gopath-
- uses: actions/setup-go@v2
with:
go-version: "1.17"
- name: Remove Unsupported Code
run: |
# Iris requires Module mode, therefore we delete the relevant code to
Expand Down
2 changes: 1 addition & 1 deletion fasthttp/sentryfasthttp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func TestIntegration(t *testing.T) {
opts := cmp.Options{
cmpopts.IgnoreFields(
sentry.Event{},
"Contexts", "EventID", "Extra", "Platform",
"Contexts", "EventID", "Extra", "Platform", "Modules",
"Release", "Sdk", "ServerName", "Tags", "Timestamp",
),
cmpopts.IgnoreMapEntries(func(k string, v string) bool {
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/getsentry/sentry-go

go 1.17
go 1.18

require (
github.com/gin-gonic/gin v1.7.7
Expand All @@ -14,6 +14,7 @@ require (
github.com/urfave/negroni v1.0.0
github.com/valyala/fasthttp v1.6.0
golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac
golang.org/x/text v0.3.7
)

require (
Expand Down Expand Up @@ -65,7 +66,6 @@ require (
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect
golang.org/x/net v0.0.0-20211008194852-3b03d305991f // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20201208040808-7e3f01d25324 // indirect
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 // indirect
gopkg.in/ini.v1 v1.51.1 // indirect
Expand Down
2 changes: 1 addition & 1 deletion http/sentryhttp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ func TestIntegration(t *testing.T) {
opts := cmp.Options{
cmpopts.IgnoreFields(
sentry.Event{},
"Contexts", "EventID", "Extra", "Platform",
"Contexts", "EventID", "Extra", "Platform", "Modules",
"Release", "Sdk", "ServerName", "Tags", "Timestamp",
),
cmpopts.IgnoreFields(
Expand Down
15 changes: 10 additions & 5 deletions internal/ratelimit/category.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
package ratelimit

import "strings"
import (
"strings"

"golang.org/x/text/cases"
"golang.org/x/text/language"
)

// Reference:
// https://github.com/getsentry/relay/blob/0424a2e017d193a93918053c90cdae9472d164bf/relay-common/src/constants.rs#L116-L127
Expand Down Expand Up @@ -31,11 +36,11 @@ func (c Category) String() string {
case "":
return "CategoryAll"
default:
var b strings.Builder
b.WriteString("Category")
caser := cases.Title(language.English)
rv := "Category"
for _, w := range strings.Fields(string(c)) {
b.WriteString(strings.Title(w))
rv += caser.String(w)
}
return b.String()
return rv
}
}
4 changes: 2 additions & 2 deletions tracing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func TestStartSpan(t *testing.T) {
opts := cmp.Options{
cmpopts.IgnoreFields(Event{},
"Contexts", "EventID", "Level", "Platform",
"Release", "Sdk", "ServerName",
"Release", "Sdk", "ServerName", "Modules",
),
cmpopts.EquateEmpty(),
}
Expand Down Expand Up @@ -209,7 +209,7 @@ func TestStartChild(t *testing.T) {
}
opts := cmp.Options{
cmpopts.IgnoreFields(Event{},
"EventID", "Level", "Platform",
"EventID", "Level", "Platform", "Modules",
"Release", "Sdk", "ServerName", "Timestamp", "StartTime",
),
cmpopts.IgnoreMapEntries(func(k string, v interface{}) bool {
Expand Down

0 comments on commit 335847c

Please sign in to comment.