fuyou001 opened a new pull request, #1488:
URL: https://github.com/apache/rocketmq-clients/pull/1488

   ### Which Issue(s) This PR Fixes
   
   No linked issue.
   
   ### Brief Description
   
   The Go examples currently use access key and secret key constants, 
encouraging users to store real credentials in source files. All eight producer 
examples and four consumer examples now read `ROCKETMQ_ACCESS_KEY` and 
`ROCKETMQ_SECRET_KEY` directly from the environment when constructing their 
clients.
   
   Remove the credential constants and document the environment variables and 
example setup in the Go README. Unset variables yield empty strings, preserving 
the empty-credential configuration used by local examples without broker 
authentication. There is no hardcoded credential fallback.
   
   ### How Did You Test This Change?
   
   Run from `golang` with Go 1.27.3:
   
   - `go build ./...`
   - `go test ./... -timeout 5m`
   
   Additional checks:
   
   - `gofmt -l golang/example` (no output)
   - `git diff --check`
   - `npx --yes markdownlint-cli -c style/markdown/config.yml golang/README.md`
   - Checked all 12 credential initializers and confirmed no example credential 
constants remain.
   
   ### Review Scope and Limitations
   
   - Entrypoints inspected: producers `async`, `delay`, `delay_recall`, `fifo`, 
`lite`, `normal`, `priority`, and `transaction`; consumers `simple_consumer`, 
`push_consumer`, `lite_simple_consumer`, and `lite_push_consumer`. Traced their 
constructors through `NewClient` to `Sign`. Inspected the async send callback, 
transaction checker, push listeners, and background receive/ACK loops.
   - Configuration branches inspected: environment variables populated, unset, 
empty, or partially configured; broker authentication enabled or disabled; 
existing TLS settings. No feature flags are added or changed. These checks were 
by source inspection, not live broker authentication tests.
   - Compatibility: SDK APIs, credential structures, wire signing, and 
persisted data are unchanged. Mixed-version clients/servers and rolling 
upgrades use the same authentication protocol. Rebuilt examples obtain 
credentials at startup and must receive the variables again after restart; 
downgrading to the old examples restores their source-constant configuration.
   - Failure paths inspected: environment lookup returns a string without an 
error; constructor and startup errors retain their existing handling and 
startup cleanup. Async sends, transaction callbacks, receive/ACK errors, 
request cancellation/timeouts, and retries retain the same captured client 
credentials and control flow.
   - Test coverage gap: no live broker authentication test was run. A broker 
smoke test should assert that environment-supplied credentials authenticate, 
missing or partial credentials are rejected when authentication is required, 
and unset credentials work when authentication is disabled. The examples have 
no existing unit tests; no SDK behavior or new helper was introduced.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to