From ead310e0716aee243cb2c6a69f53f511531c549e Mon Sep 17 00:00:00 2001 From: Hayato Kawai Date: Mon, 31 Aug 2026 19:13:54 +0900 Subject: [PATCH 1/6] cmd/subee: update golang.org/x/tools to fix test panic on newer Go intent(cmd/subee): unblock running `go test` under current Go toolchains as part of the CircleCI to GitHub Actions migration learned(cmd/subee): golang.org/x/tools v0.0.0-20191017035025-0abb09c987dd panics with "internal error: package ... without types was imported from ..." under Go 1.26 because go/packages' loader protocol changed since that pre-modules-era release --- cmd/subee/go.mod | 18 ++++++++++++++---- cmd/subee/go.sum | 26 ++++++++++++++------------ 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/cmd/subee/go.mod b/cmd/subee/go.mod index 4be2d41..0e655fa 100644 --- a/cmd/subee/go.mod +++ b/cmd/subee/go.mod @@ -1,6 +1,6 @@ module github.com/wantedly/subee/cmd/subee -go 1.13 +go 1.25.0 require ( github.com/bradleyjkemp/cupaloy v2.3.0+incompatible @@ -8,7 +8,17 @@ require ( github.com/logrusorgru/aurora v0.0.0-20191017060258-dc85c304c434 github.com/pkg/errors v0.8.1 github.com/spf13/cobra v0.0.5 - golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e - golang.org/x/text v0.3.2 - golang.org/x/tools v0.0.0-20191017035025-0abb09c987dd + golang.org/x/sync v0.22.0 + golang.org/x/text v0.41.0 + golang.org/x/tools v0.49.0 + golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated +) + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/spf13/pflag v1.0.3 // indirect + golang.org/x/mod v0.39.0 // indirect + golang.org/x/tools/go/expect v0.1.0-deprecated // indirect ) diff --git a/cmd/subee/go.sum b/cmd/subee/go.sum index dde36c4..b992276 100644 --- a/cmd/subee/go.sum +++ b/cmd/subee/go.sum @@ -9,6 +9,8 @@ github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwc github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/iancoleman/strcase v0.0.0-20190422225806-e506e3ef7365 h1:ECW73yc9MY7935nNYXUkK7Dz17YuSUI9yqRqYS8aBww= github.com/iancoleman/strcase v0.0.0-20190422225806-e506e3ef7365/go.mod h1:SK73tn/9oHe+/Y0h39VT4UCxmurVJkR5NA7kMEAOgSE= @@ -37,19 +39,19 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/mod v0.39.0 h1:UF5zwQdCRRUpHfyPwr7d4UrGiVeldIsogtzWVnczL74= +golang.org/x/mod v0.39.0/go.mod h1:bvIbwjQ0HUFFf5AKukeeYQG4ZBUG9yxQbR9aEweIwYY= +golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= +golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191017035025-0abb09c987dd h1:05UlZ/D8j3ueatR0iMtGQ8BOUKChM5b0XY/c50tSFe4= -golang.org/x/tools v0.0.0-20191017035025-0abb09c987dd/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8= +golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M= +golang.org/x/tools v0.49.0 h1:3NI7VXzL9+1WZD52Dx2ttoPwD5DWrFGpl9mFZDlmisI= +golang.org/x/tools v0.49.0/go.mod h1:SJNXV9DBKT0UbdttsQjbfJlAE/q+y36++zo3uL3N0Oo= +golang.org/x/tools/go/expect v0.1.0-deprecated h1:jY2C5HGYR5lqex3gEniOQL0r7Dq5+VGVgY1nudX5lXY= +golang.org/x/tools/go/expect v0.1.0-deprecated/go.mod h1:eihoPOH+FgIqa3FpoTwguz/bVUSGBlGQU67vpBeOrBY= +golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated h1:1h2MnaIAIXISqTFKdENegdpAgUXz6NrPEsbIeWaBRvM= +golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated/go.mod h1:RVAQXBGNv1ib0J382/DPCRS/BPnsGebyM1Gj5VSDpG8= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= From 9f91e946d6f798ba917058b4755227c572f3f6b5 Mon Sep 17 00:00:00 2001 From: Hayato Kawai Date: Mon, 31 Aug 2026 19:14:04 +0900 Subject: [PATCH 2/6] ci: migrate from CircleCI to GitHub Actions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit intent(ci): restore a working CI so PRs get tested again — the CircleCI config had been broken since the `circleci/golang` Docker Hub images it depends on were removed, leaving the README badge permanently red decision(ci): matrix over every Go module directory instead of a single `go test ./...`, since this is a multi-module repo and the root command never reached the nested modules decision(ci): start the Pub/Sub emulator with a plain `docker run` and poll the port, since GitHub Actions' `services:` cannot override an image's command and the emulator image needs one to actually start rejected(ci): porting the CLI release job (go-crossbuild/github-release/ homebrew) and the codecov upload — out of scope, library releases only need a tag push and neither had a working badge or was requested --- .circleci/config.yml | 142 ------------------------------------- .github/workflows/test.yml | 62 ++++++++++++++++ README.md | 2 +- 3 files changed, 63 insertions(+), 143 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/test.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 8ff9da1..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,142 +0,0 @@ -version: 2.1 - -orbs: - go-module: timakin/go-module@0.3.0 - go-crossbuild: izumin5210/go-crossbuild@0.1.1 - github-release: izumin5210/github-release@0.1.1 - homebrew: izumin5210/homebrew@0.1.3 - inline: izumin5210/inline@0.1.0 - -executors: - golang: - parameters: - version: - type: string - docker: - - image: circleci/golang:<< parameters.version >> - - image: gcr.io/google.com/cloudsdktool/cloud-sdk:328.0.0 - command: [gcloud, beta, emulators, pubsub, start, '--host-port=0.0.0.0:8085'] - environment: - - GO111MODULE: "on" - - PUBSUB_EMULATOR_HOST: localhost:8085 - -aliases: - go1.11: &go-1-11 - executor: - name: golang - version: '1.11' - go1.12: &go-1-12 - executor: - name: golang - version: '1.12' - go1.13: &go-1-13 - executor: - name: golang - version: '1.13' - filter-all: &filter-all - filters: - tags: - only: /.*/ - filter-release: &filter-release - filters: - branches: - ignore: /.*/ - tags: - only: /^cmd\/subee\/v\d+\.\d+\.\d+$/ - -workflows: - version: 2 - main: - jobs: - - go-module/download: &setup-base - <<: *filter-all - <<: *go-1-13 - name: 'setup-1.13' - persist-to-workspace: true - vendoring: true - - - go-module/download: - <<: *go-1-12 - <<: *setup-base - name: 'setup-1.12' - - - go-module/download: - <<: *go-1-11 - <<: *setup-base - name: 'setup-1.11' - - - inline/steps: - <<: *go-1-13 - name: 'test-1.13' - steps: - - run: go test -coverpkg ./... -coverprofile coverage.txt -covermode atomic -race -v ./... - - run: bash <(curl -s https://codecov.io/bash) - requires: - - setup-1.13 - - - inline/steps: - <<: *go-1-12 - name: 'test-1.12' - steps: - - run: go test -race -v ./... - requires: - - setup-1.12 - - - inline/steps: - <<: *go-1-11 - name: 'test-1.11' - steps: - - run: go test -race -v ./... - requires: - - setup-1.11 - - - inline/steps: &e2e-base - <<: *go-1-13 - name: 'test-e2e-1.13' - steps: - - run: - name: Wait for pubsub emulator - command: sleep 5 - - run: cd _tests/cloudpubsub && go test -v ./... - requires: - - setup-1.13 - - - inline/steps: - <<: *go-1-12 - <<: *e2e-base - name: 'test-e2e-1.12' - requires: - - setup-1.12 - - - inline/steps: - <<: *go-1-11 - <<: *e2e-base - name: 'test-e2e-1.11' - requires: - - setup-1.11 - - - go-crossbuild/build: - <<: *filter-all - <<: *go-1-13 - app-name: subee - packages: ./cmd/subee - requires: - - setup-1.13 - - - github-release/create: - <<: *filter-release - context: tool-releasing - requires: - - test-1.13 - - test-1.12 - - test-1.11 - - test-e2e-1.13 - - test-e2e-1.12 - - test-e2e-1.11 - - go-crossbuild/build - - - homebrew/update: - <<: *filter-release - context: tool-releasing - requires: - - github-release/create diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..bee74e7 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,62 @@ +name: test + +on: + push: + branches: [master] + pull_request: + +permissions: + contents: read + +jobs: + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + go: [oldstable, stable] + # Each directory is a separate Go module, so `go test ./...` at the repo + # root does not reach them. + module: + - . + - cmd/subee + - middlewares/logging/zap + - middlewares/recovery + - stats/newrelic + - subscribers/cloudpubsub + - _examples/your-first-cloudpubsub-app + name: test (${{ matrix.module }}, ${{ matrix.go }}) + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 + with: + go-version: ${{ matrix.go }} + cache-dependency-path: ${{ matrix.module }}/go.sum + - run: go test -race ./... + working-directory: ${{ matrix.module }} + + e2e: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + go: [oldstable, stable] + name: e2e (${{ matrix.go }}) + env: + PUBSUB_EMULATOR_HOST: localhost:8085 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 + with: + go-version: ${{ matrix.go }} + cache-dependency-path: _tests/cloudpubsub/go.sum + # `services:` cannot override the image's command, and this image does + # not start the emulator on its own. + - name: Start Pub/Sub emulator + run: | + docker run -d --rm -p 8085:8085 \ + gcr.io/google.com/cloudsdktool/google-cloud-cli:emulators \ + gcloud beta emulators pubsub start --host-port=0.0.0.0:8085 + timeout 60 bash -c 'until curl -sf http://localhost:8085 >/dev/null; do sleep 1; done' + - run: go test -race ./... + working-directory: _tests/cloudpubsub diff --git a/README.md b/README.md index 5656420..cf51f72 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![subee](docs/subee.png) -[![CircleCI](https://circleci.com/gh/wantedly/subee/tree/master.svg?style=svg)](https://circleci.com/gh/wantedly/subee/tree/master) +[![test](https://github.com/wantedly/subee/actions/workflows/test.yml/badge.svg)](https://github.com/wantedly/subee/actions/workflows/test.yml) [![latest](https://img.shields.io/github/release/wantedly/subee.svg)](https://github.com/wantedly/subee/releases/latest) [![GoDoc](https://godoc.org/github.com/wantedly/subee?status.svg)](https://godoc.org/github.com/wantedly/subee) [![Go Report Card](https://goreportcard.com/badge/github.com/wantedly/subee)](https://goreportcard.com/report/github.com/wantedly/subee) From ddea7464eca9adec3eeae52a1faf5322216268b6 Mon Sep 17 00:00:00 2001 From: Hayato Kawai Date: Mon, 31 Aug 2026 19:27:52 +0900 Subject: [PATCH 3/6] engine_test: guard shared test state with a mutex to fix data race intent(engine_test): let `go test -race` pass reliably now that CI actually runs it again learned(engine_test): handleMessage runs each consumed message/batch in its own goroutine by design, so the consumer callbacks in these tests can run concurrently; TestEngine masked this by sleeping 6ms between messages, but TestEngineWithBatchConsumer's tighter timing let two callback invocations race on `cur` and the `resultCh` close, which -race reliably caught --- engine_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/engine_test.go b/engine_test.go index 6464fcd..756eeff 100644 --- a/engine_test.go +++ b/engine_test.go @@ -48,9 +48,13 @@ func TestEngine(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) + var mu sync.Mutex var cur int subscriber := subee_testing.NewFakeSubscriber() consumer := subee.ConsumerFunc(func(ctx context.Context, msg subee.Message) error { + mu.Lock() + defer mu.Unlock() + r := &Result{ tc: cases[cur], msg: msg.(*subee_testing.FakeMessage), @@ -168,9 +172,13 @@ func TestEngineWithBatchConsumer(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) + var mu sync.Mutex var cur int subscriber := subee_testing.NewFakeSubscriber() consumer := subee.BatchConsumerFunc(func(ctx context.Context, msgs []subee.Message) error { + mu.Lock() + defer mu.Unlock() + r := &Result{tc: cases[cur]} for _, m := range msgs { r.msgs = append(r.msgs, m.(*subee_testing.FakeMessage)) From 683c7980f9bbf0f2310261753851551d8d1afefd Mon Sep 17 00:00:00 2001 From: Hayato Kawai Date: Mon, 31 Aug 2026 19:27:57 +0900 Subject: [PATCH 4/6] ci: keep verbose test output and surface emulator logs on failure intent(ci): match the removed CircleCI config's verbosity and make e2e failures debuggable from the Actions log alone decision(ci): keep the Pub/Sub emulator container running (drop --rm) and dump its logs only `if: failure()`, since the runner is ephemeral anyway so there's nothing to clean up --- .github/workflows/test.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bee74e7..a9d056a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,7 +16,7 @@ jobs: matrix: go: [oldstable, stable] # Each directory is a separate Go module, so `go test ./...` at the repo - # root does not reach them. + # root does not reach them. Add new modules here when they're created. module: - . - cmd/subee @@ -32,7 +32,7 @@ jobs: with: go-version: ${{ matrix.go }} cache-dependency-path: ${{ matrix.module }}/go.sum - - run: go test -race ./... + - run: go test -race -v ./... working-directory: ${{ matrix.module }} e2e: @@ -54,9 +54,13 @@ jobs: # not start the emulator on its own. - name: Start Pub/Sub emulator run: | - docker run -d --rm -p 8085:8085 \ + cid=$(docker run -d -p 8085:8085 \ gcr.io/google.com/cloudsdktool/google-cloud-cli:emulators \ - gcloud beta emulators pubsub start --host-port=0.0.0.0:8085 + gcloud beta emulators pubsub start --host-port=0.0.0.0:8085) + echo "PUBSUB_EMULATOR_CID=$cid" >> "$GITHUB_ENV" timeout 60 bash -c 'until curl -sf http://localhost:8085 >/dev/null; do sleep 1; done' - - run: go test -race ./... + - run: go test -race -v ./... working-directory: _tests/cloudpubsub + - name: Show Pub/Sub emulator logs + if: failure() + run: docker logs "$PUBSUB_EMULATOR_CID" From 6f54c4559ffcf4035822013827a9f00c21b1c8c2 Mon Sep 17 00:00:00 2001 From: Hayato Kawai Date: Mon, 31 Aug 2026 20:04:03 +0900 Subject: [PATCH 5/6] cmd/subee: explicitly import subee in generated code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit intent(cmd/subee): fix TestSubscriberGenerator failing in CI, where it passed locally learned(cmd/subee): generated files never wrote the "github.com/wantedly/subee" import themselves, relying on imports.Process (goimports) to guess and add it; that guess scans the machine's real $GOMODCACHE regardless of the test's own isolated packages.Config.Env, so it silently succeeds only on machines that happen to have the module cached already — CI's clean cache always misses it decision(cmd/subee): add the import unconditionally and let imports.Process prune it when actually unused, instead of relying on it to add imports it can't reliably resolve --- cmd/subee/internal/generator/subscriber.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/subee/internal/generator/subscriber.go b/cmd/subee/internal/generator/subscriber.go index f16c546..b70a2b1 100644 --- a/cmd/subee/internal/generator/subscriber.go +++ b/cmd/subee/internal/generator/subscriber.go @@ -46,6 +46,13 @@ func (g *subscriberGeneratorImpl) Generate(ctx context.Context, params *Subscrib return errors.Errorf("invalid packages.LoadMode: %v", g.pkgCfg.Mode) } + // Every generated consumer/adapter file references the subee package, but not + // all of them do (e.g. an adapter-less consumer that only uses subee.Message). + // imports.Process can't reliably guess this third-party import (its resolution + // depends on what's already in the local module cache), so add it explicitly + // here and let imports.Process prune it where it ends up unused. + params.Imports = append(params.Imports, Package{Path: "github.com/wantedly/subee"}) + if params.IsWithAdapter() { pkgs, err := packages.Load(g.pkgCfg, params.Package.Path) if err != nil { @@ -184,6 +191,7 @@ func main() { import ( "github.com/srvc/appctx" "github.com/pkg/errors" + "github.com/wantedly/subee" ) func run() error { From a0d9461f970d671fe56ac40adfe3e66451de2a45 Mon Sep 17 00:00:00 2001 From: Hayato Kawai Date: Tue, 1 Sep 2026 10:29:04 +0900 Subject: [PATCH 6/6] cmd/subee: fix contradictory example in the subee-import comment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit learned(cmd/subee): the comment's own example (an adapter-less consumer using subee.Message) was a case that DOES reference subee, not one that doesn't — the file that actually lacks the reference is the with-adapter consumer interface, which only deals with the concrete message type --- cmd/subee/internal/generator/subscriber.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/subee/internal/generator/subscriber.go b/cmd/subee/internal/generator/subscriber.go index b70a2b1..91bdd94 100644 --- a/cmd/subee/internal/generator/subscriber.go +++ b/cmd/subee/internal/generator/subscriber.go @@ -46,11 +46,11 @@ func (g *subscriberGeneratorImpl) Generate(ctx context.Context, params *Subscrib return errors.Errorf("invalid packages.LoadMode: %v", g.pkgCfg.Mode) } - // Every generated consumer/adapter file references the subee package, but not - // all of them do (e.g. an adapter-less consumer that only uses subee.Message). - // imports.Process can't reliably guess this third-party import (its resolution - // depends on what's already in the local module cache), so add it explicitly - // here and let imports.Process prune it where it ends up unused. + // Not every generated file references subee directly (e.g. the with-adapter + // consumer interface only deals with the concrete message type). imports.Process + // resolves missing third-party imports via the local module cache, so it can + // silently fail to add this one on a clean cache (e.g. CI); add it + // unconditionally and let imports.Process prune it where it ends up unused. params.Imports = append(params.Imports, Package{Path: "github.com/wantedly/subee"}) if params.IsWithAdapter() {