Skip to content

Commit

Permalink
chore: upgrade to Go 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
palkan committed Jan 10, 2024
1 parent e6043df commit 0e2521e
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 50 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ on:
jobs:
benchmark:
timeout-minutes: 10
strategy:
matrix:
go-version: [1.20.x]
runs-on: ubuntu-latest
env:
GO111MODULE: on
Expand All @@ -26,10 +23,10 @@ jobs:
ports: ["6379:6379"]
options: --health-cmd="redis-cli ping" --health-interval 1s --health-timeout 3s --health-retries 30
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
go-version-file: go.mod
- name: Install system deps
run: |
sudo apt-get update
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: 1.20.x
go-version-file: go.mod
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.52.2
version: v1.55.2
args: --timeout 3m
4 changes: 2 additions & 2 deletions .github/workflows/release-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
run: bash -c '(cd vendor/github.com/mitchellh/go-mruby && MRUBY_CONFIG=../../../../../../etc/build_config.rb make libmruby.a)'
- uses: actions/setup-go@v4
with:
go-version: 1.20.x
go-version-file: go.mod
- name: Set VERSION (if any)
if: ${{ contains(github.ref, 'refs/tags/v') }}
id: version
Expand Down Expand Up @@ -88,7 +88,7 @@ jobs:
run: bash -c '(cd vendor/github.com/mitchellh/go-mruby && MRUBY_CONFIG=../../../../../../etc/build_config.rb make libmruby.a)'
- uses: actions/setup-go@v4
with:
go-version: 1.20.x
go-version-file: go.mod
- name: Set VERSION (if any)
if: ${{ contains(github.ref, 'refs/tags/v') }}
id: version
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
CGO_ENABLED: "0"
GOFLAGS: "-mod=vendor"
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Install system deps
run: |
sudo apt-get update
Expand All @@ -26,9 +26,9 @@ jobs:
- run: go mod vendor
- name: Build mruby
run: bash -c '(cd vendor/github.com/mitchellh/go-mruby && MRUBY_CONFIG=../../../../../../etc/build_config.rb make libmruby.a)'
- uses: actions/setup-go@v2
- uses: actions/setup-go@v4
with:
go-version: 1.20.x
go-version-file: go.mod
- name: Set VERSION (if any)
if: ${{ contains(github.ref, 'refs/tags/v') }}
id: version
Expand Down
37 changes: 17 additions & 20 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ on:
jobs:
test:
if: "!contains(github.event.head_commit.message, '[ci skip tests]')"
strategy:
matrix:
go-version: [1.20.x]
runs-on: ubuntu-20.04
env:
GO111MODULE: on
Expand All @@ -24,7 +21,7 @@ jobs:
ports: ["6379:6379"]
options: --health-cmd="redis-cli ping" --health-interval 1s --health-timeout 3s --health-retries 30
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install system deps
run: |
sudo apt-get update
Expand All @@ -38,9 +35,9 @@ jobs:
- run: go mod vendor
- name: Build mruby
run: bash -c '(cd vendor/github.com/mitchellh/go-mruby && MRUBY_CONFIG=../../../../../../etc/build_config.rb make libmruby.a)'
- uses: actions/setup-go@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
go-version-file: go.mod
- name: Run tests
run: make test
- name: Report coverage
Expand All @@ -50,31 +47,27 @@ jobs:
parallel: true
flag-name: ${{ matrix.go-version }}-ubuntu
- name: Build
if: matrix['go-version'] == '1.20.x'
run: |
make build
- name: Upload linux build
if: matrix['go-version'] == '1.20.x' && (github.ref == 'refs/head/master' || contains(github.event.pull_request.body, '[Build]'))
if: (github.ref == 'refs/head/master' || contains(github.event.pull_request.body, '[Build]'))
uses: actions/upload-artifact@v1
with:
name: anycable-go-Linux-x86_64
path: dist/anycable-go

test-macos:
if: "!contains(github.event.head_commit.message, '[ci skip tests]')"
strategy:
matrix:
go-version: [1.20.x]
runs-on: macos-11
runs-on: macos-latest
env:
GO111MODULE: on
GOFLAGS: "-mod=vendor"
COVERAGE: "true"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v2
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
go-version-file: go.mod
- name: Install system deps
run: |
brew install bison
Expand All @@ -84,6 +77,11 @@ jobs:
key: vendor-${{ hashFiles('**/go.sum') }}
restore-keys: |
vendor-
- uses: ruby/setup-ruby@v1
with:
# Use <3.0 since go-mruby's Rakefile has some problems with keyword arguments compatibility
ruby-version: 2.7
bundler-cache: true
- run: go mod vendor
- name: Build mruby
run: bash -c '(cd vendor/github.com/mitchellh/go-mruby && MRUBY_CONFIG=../../../../../../etc/build_config.rb make libmruby.a)'
Expand All @@ -96,11 +94,10 @@ jobs:
parallel: true
flag-name: ${{ matrix.go-version }}-macos
- name: Build
if: matrix['go-version'] == '1.20.x'
run: |
make build
- name: Upload MacOS build
if: matrix['go-version'] == '1.20.x' && (github.ref == 'refs/head/master' || contains(github.event.pull_request.body, '[Build]'))
if: (github.ref == 'refs/head/master' || contains(github.event.pull_request.body, '[Build]'))
uses: actions/upload-artifact@v1
with:
name: anycable-go-Darwin-x86_64
Expand Down Expand Up @@ -143,10 +140,10 @@ jobs:
image: nats:alpine
ports: ["4222:4222"]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: 1.20.x
go-version-file: go.mod
- name: Install system deps
run: |
sudo apt-get update
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ gen-ssl:

bin/golangci-lint:
@test -x $$(go env GOPATH)/bin/golangci-lint || \
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$(go env GOPATH)/bin v1.52.2
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$(go env GOPATH)/bin v1.55.2

lint: bin/golangci-lint
$$(go env GOPATH)/bin/golangci-lint run
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/anycable/anycable-go

go 1.20
go 1.21

require (
github.com/FZambia/sentinel v1.1.0
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-github/v28 v28.1.1/go.mod h1:bsqJWQX05omyWVmc00nEUql9mhQyv38lDZ8kPZcQVoM=
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
github.com/google/go-replayers/grpcreplay v0.1.0/go.mod h1:8Ig2Idjpr6gifRd6pNVggX6TC1Zw6Jx74AKp7QNH2QE=
Expand Down Expand Up @@ -200,6 +201,7 @@ github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfn
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/matoous/go-nanoid v1.5.0 h1:VRorl6uCngneC4oUQqOYtO3S0H5QKFtKuKycFG3euek=
Expand Down Expand Up @@ -241,6 +243,7 @@ github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI=
github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M=
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
Expand All @@ -252,6 +255,7 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
github.com/posthog/posthog-go v0.0.0-20221221115252-24dfed35d71a h1:Ey0XWvrg6u6hyIn1Kd/jCCmL+bMv9El81tvuGBbxZGg=
github.com/posthog/posthog-go v0.0.0-20221221115252-24dfed35d71a/go.mod h1:oa2sAs9tGai3VldabTV0eWejt/O4/OOD7azP8GaikqU=
github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g=
github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
Expand Down
15 changes: 2 additions & 13 deletions utils/gopool.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,9 @@ func AllPools() []*GoPool {
// Start size defaults to 20% of the max size but not greater than 1024.
// Queue size defaults to 50% of the max size.
func NewGoPool(name string, size int) *GoPool {
spawn := size / 5
queue := size / 2
queue := min(size/2, 1)

if spawn <= 0 {
spawn = 1
}

if spawn > 1024 {
spawn = 1024
}

if queue <= 0 {
queue = 1
}
spawn := min(max(size/5, 1), 1024)

p := &GoPool{
name: name,
Expand Down

0 comments on commit 0e2521e

Please sign in to comment.