jason810496 commented on code in PR #67153: URL: https://github.com/apache/airflow/pull/67153#discussion_r3296397577
########## go-sdk/adr/0002-use-go-tool-directive-for-bundle-packer.md: ########## @@ -0,0 +1,222 @@ +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + --> + +# 2. Use the Go 1.24 `tool` directive to deliver the bundle packer + +Date: 2026-04-30 + +## Status + +Accepted. Selects from the option register in +[ADR 0001](0001-bundle-packing-options.md). + +The output-format portion of this ADR (the packer writes a ZIP archive +following the bundle spec) is superseded by +[ADR 0004](0004-self-contained-executable-bundle.md): the packer now +writes a self-contained executable with an appended footer carrying +the source bytes and the manifest. The packer's *mechanism* (Option +A standalone binary + Option D introspection contract + Option H +`tool` directive) is unchanged. The decision sketches below mention +ZIP output; read them with the ADR 0004 substitution in mind, and +treat ADR 0004 as authoritative wherever the two disagree. + +## Context + +[ADR 0001](0001-bundle-packing-options.md) enumerated nine candidate +mechanisms for producing a conforming bundle ZIP +([`task-sdk/docs/bundle-spec.rst`](../../task-sdk/docs/bundle-spec.rst)) +from a Go SDK build. Two reasons drive the choice: + +1. **The repository already requires Go 1.24.** `go-sdk/go.mod` declares + `go 1.24.0` with `toolchain go1.24.6`, so language features added in + 1.24 are available to every consumer of the SDK by construction. +2. **Contributors expect Go-native workflows.** The Go 1.24 `tool` + directive is the toolchain's native answer to "depend on a + build-time CLI without polluting the global PATH." It pins the tool + version per-project in `go.mod`, resolves it through the standard + module cache, and exposes it as `go tool <name>`, with no extra + installer and no per-worktree drift. The same problem on the Python + side led `breeze` to switch to `uvx` in + [ADR 0017](../../dev/breeze/doc/adr/0017-use-uvx-to-run-breeze-from-local-sources.md); + `tool` is the analogous answer here. + +The `tool` directive is a delivery mechanism. It still needs an +underlying implementation. We pair it with two of the implementation +options from ADR 0001, with a UX twist: + +- **Option A (standalone packer):** a single-purpose binary at + `go-sdk/cmd/airflow-go-pack`. It still operates as one process with + a clear input/output contract, but it drives `go build` internally + by default so that the common case is one command: + `go tool airflow-go-pack ./pkg`. Authors who already produce their + own binary can opt out via `--executable <path>` and skip the build + phase. This is closer to Option B's ergonomics than the original + ADR 0001 sketch, but kept inside the standalone-packer shape so the + SDK does not own a fully general `go build` wrapper. Review Comment: 6e96fdf298 Replace "fully general" hedge with the actual go-build-flag rule. The packer will not interpret any flags after `--`, it will only be treated as separator for `go build` command. -- 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]
