-
Notifications
You must be signed in to change notification settings - Fork 713
Reopen in maintenance mode #247
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
base: master
Are you sure you want to change the base?
Changes from all commits
18a238d
bcc7d34
720bdab
e13c645
05d4450
a6e40ab
279ed80
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,62 @@ | ||
| name: ci | ||
|
|
||
| permissions: | ||
| contents: read | ||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| branches: | ||
| - master | ||
|
Comment on lines
+11
to
+12
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps add This commit could also be put before the go1.26 feature commit, making it part of the "baseline".
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Renaming branches does not seem compliant with maintenance mode. |
||
| pull_request: | ||
|
|
||
| jobs: | ||
| dummy: | ||
| runs-on: ubuntu-latest | ||
| build: | ||
| runs-on: ubuntu-24.04 | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| goversion: ["1.20", "1.21", "1.22", "1.23", "1.24", "1.25", "1.26"] | ||
tonistiigi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| steps: | ||
| - uses: docker/setup-buildx-action@v3 | ||
| - uses: docker/bake-action@v7 | ||
| with: | ||
| targets: build-all | ||
| env: | ||
| GO_VERSION: ${{ matrix.goversion }} | ||
| test: | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - uses: docker/setup-buildx-action@v3 | ||
| - uses: docker/bake-action@v7 | ||
| with: | ||
| targets: test | ||
| env: | ||
| COVER_FILENAME: "cover.out" | ||
| - name: Upload coverage to Codecov | ||
| uses: codecov/codecov-action@v4 | ||
| with: | ||
| disable_file_fixes: true | ||
| files: ./cover.out | ||
| token: ${{ secrets.CODECOV_TOKEN }} | ||
| test-os: | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [macos-latest, windows-latest] | ||
tonistiigi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: stable | ||
| - run: go test -v ./... | ||
| lint: | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - | ||
| name: Checkout | ||
| uses: actions/checkout@v2 | ||
| - uses: docker/setup-buildx-action@v3 | ||
| - uses: docker/bake-action@v7 | ||
| with: | ||
| targets: lint-all | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| version: "2" | ||
|
|
||
| run: | ||
| timeout: 10m | ||
|
|
||
| formatters: | ||
| enable: | ||
| - gofmt | ||
| - goimports | ||
|
|
||
| linters: | ||
| default: standard | ||
| enable: | ||
| - bodyclose | ||
| - forbidigo | ||
| - gocritic | ||
| - gosec | ||
| - importas | ||
| - makezero | ||
| - misspell | ||
| - noctx | ||
| - nolintlint | ||
| - revive | ||
| - unconvert | ||
| - unparam | ||
| - whitespace | ||
| settings: | ||
| errcheck: | ||
| exclude-functions: | ||
| - io.WriteString | ||
| exclusions: | ||
| presets: | ||
| - std-error-handling | ||
| rules: | ||
| - linters: | ||
| - gosec | ||
| text: "G104" | ||
| - linters: | ||
| - staticcheck | ||
| text: "QF1008" |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| #syntax=docker/dockerfile:1 | ||
| #check=error=true | ||
|
|
||
| ARG GO_VERSION=1.26 | ||
| ARG XX_VERSION=1.9.0 | ||
|
|
||
| ARG COVER_FILENAME="cover.out" | ||
|
|
||
| FROM --platform=${BUILDPLATFORM} tonistiigi/xx:${XX_VERSION} AS xx | ||
|
|
||
| FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION}-alpine AS golang | ||
| COPY --link --from=xx / / | ||
| WORKDIR /src | ||
| ARG TARGETPLATFORM | ||
|
|
||
| FROM golang AS build | ||
| RUN --mount=target=/root/.cache,type=cache \ | ||
| --mount=type=bind xx-go build ./... | ||
|
|
||
| FROM golang AS runtest | ||
| ARG TESTFLAGS="-v" | ||
| ARG COVER_FILENAME | ||
| RUN --mount=target=/root/.cache,type=cache \ | ||
| --mount=type=bind \ | ||
| xx-go test -coverprofile=/tmp/${COVER_FILENAME} $TESTFLAGS ./... | ||
|
|
||
| FROM scratch AS test | ||
| ARG COVER_FILENAME | ||
| COPY --from=runtest /tmp/${COVER_FILENAME} / | ||
|
|
||
| FROM build |
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| //go:build !go1.26 | ||
|
|
||
| package errors | ||
|
Comment on lines
+1
to
+3
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This commit starts the work of picking up maintenance; I think it would make sense to move this (and forward) separate. (Steps before this were just setting the baseline)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moved to last |
||
|
|
||
| // AsType finds the first error in err's chain that matches type E, | ||
| // and if so, returns that error value and true. | ||
| func AsType[E error](err error) (E, bool) { | ||
| var target E | ||
| return target, As(err, &target) | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| //go:build go1.26 | ||
|
|
||
| package errors | ||
|
|
||
| import ( | ||
| stderrors "errors" | ||
| ) | ||
|
|
||
| // AsType finds the first error in err's chain that matches type E, | ||
| // and if so, returns that error value and true. | ||
| func AsType[E error](err error) (E, bool) { | ||
| return stderrors.AsType[E](err) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,3 @@ | ||
| // +build go1.7 | ||
|
|
||
| package errors | ||
|
|
||
| import ( | ||
|
|
@@ -25,7 +23,7 @@ func yesErrors(at, depth int) error { | |
|
|
||
| // GlobalE is an exported global to store the result of benchmark results, | ||
| // preventing the compiler from optimising the benchmark functions away. | ||
| var GlobalE interface{} | ||
| var GlobalE any | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. modernize is not same as lint. These changes make the code use the latest conventions but are not required for the code to work properly and lint pass in recent Go. |
||
|
|
||
| func BenchmarkErrors(b *testing.B) { | ||
| type run struct { | ||
|
|
@@ -97,7 +95,7 @@ func BenchmarkStackFormatting(b *testing.B) { | |
| name := fmt.Sprintf("%s-stacktrace-%d", r.format, r.stack) | ||
| b.Run(name, func(b *testing.B) { | ||
| err := yesErrors(0, r.stack) | ||
| st := err.(*fundamental).stack.StackTrace() | ||
| st := err.(*fundamental).StackTrace() | ||
| b.ReportAllocs() | ||
| b.ResetTimer() | ||
| for i := 0; i < b.N; i++ { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| variable "COVER_FILENAME" { | ||
| default = null | ||
| } | ||
|
|
||
| variable "GO_VERSION" { | ||
| default = null | ||
| } | ||
|
|
||
| target "default" { | ||
| targets = ["build"] | ||
| } | ||
|
|
||
| target "_all_platforms" { | ||
| platforms = [ | ||
| "linux/amd64", | ||
| "linux/arm64", | ||
| "linux/arm/v7", | ||
| "linux/arm/v6", | ||
| "linux/386", | ||
| "linux/ppc64le", | ||
| "linux/s390x", | ||
| "linux/riscv64", | ||
| "darwin/amd64", | ||
| "darwin/arm64", | ||
| "windows/amd64", | ||
| "windows/arm64", | ||
| ] | ||
| } | ||
|
|
||
| target "build" { | ||
| output = ["type=cacheonly"] | ||
| args = { | ||
| GO_VERSION = GO_VERSION | ||
| } | ||
| } | ||
|
|
||
| target "build-all" { | ||
| inherits = ["build", "_all_platforms"] | ||
| } | ||
|
|
||
| target "test" { | ||
| target = "test" | ||
| args = { | ||
| COVER_FILENAME = COVER_FILENAME | ||
| GO_VERSION = GO_VERSION | ||
| } | ||
| output = [COVER_FILENAME != null ? "." : "type=cacheonly"] | ||
| } | ||
|
|
||
| target "lint" { | ||
| dockerfile = "hack/dockerfiles/lint.Dockerfile" | ||
| output = ["type=cacheonly"] | ||
| } | ||
|
|
||
| target "lint-all" { | ||
| inherits = ["lint", "_all_platforms"] | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.