Skip to content

feat(internal/librarian/golang): support configurable tool dependencies in librarian.yaml#5421

Merged
sofisl merged 16 commits intomainfrom
addGoToolsToConfigTools
Apr 17, 2026
Merged

feat(internal/librarian/golang): support configurable tool dependencies in librarian.yaml#5421
sofisl merged 16 commits intomainfrom
addGoToolsToConfigTools

Conversation

@sofisl
Copy link
Copy Markdown
Contributor

@sofisl sofisl commented Apr 15, 2026

The current install implementation for golang has a hard-coded list of modules and versions to install. This makes it difficult to update the versions of Go tools used for GAPIC generation per repository. This change adds support for defining Go tool dependencies in librarian.yaml under the tools property, similar to other languages. It introduces the GoTool struct in config, updates the installer to fetch dependencies from configuration (falling back to defaults if not defined), and regenerates the configuration schema documentation.

Fixes #5377

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for Go tool installation via the librarian.yaml configuration, including schema updates, configuration struct additions, and implementation of the installation logic with a fallback mechanism. Feedback focuses on handling cases where a tool version is not specified to avoid invalid go install commands, and removing the unused Exec field from both the configuration and documentation to adhere to the YAGNI principle.

Comment thread internal/librarian/golang/install.go Outdated
Comment thread internal/config/config.go
Comment thread doc/config-schema.md Outdated
@sofisl
Copy link
Copy Markdown
Contributor Author

sofisl commented Apr 15, 2026

@noahdietz, here are a few decisions/assumptions I made in this PR (feel free to correct me!):

  • Left the hardocded tools as a fallback
  • Included the Exec property as an explicit binary name, that should override the goimports binary.

some more questions about exec - do you want it to be derived if not specified? (according to #5201)?

@sofisl sofisl marked this pull request as ready for review April 15, 2026 23:55
@sofisl sofisl requested a review from a team as a code owner April 15, 2026 23:55
Comment thread internal/librarian/golang/format.go Outdated
Comment thread internal/librarian/golang/format.go Outdated
Comment thread internal/librarian/golang/install.go Outdated
Comment thread internal/librarian/golang/install.go Outdated
@JoeWang1127
Copy link
Copy Markdown
Contributor

Left the hardocded tools as a fallback

Should we file an issue as a follow up to remove the hardcode tools once the tool section is introduced to librarian.yaml in google-cloud-go?

sofisl and others added 3 commits April 16, 2026 09:35
Co-authored-by: Joe Wang <106995533+JoeWang1127@users.noreply.github.com>
Signed-off-by: sofisl <55454395+sofisl@users.noreply.github.com>
Comment thread internal/librarian/golang/install.go Outdated
Comment thread internal/librarian/librarian.go Outdated
Comment thread internal/librarian/golang/format.go Outdated
Comment thread internal/config/config.go Outdated
Comment thread internal/librarian/golang/format.go Outdated
@sofisl sofisl requested review from JoeWang1127 and julieqiu April 16, 2026 22:40
Comment thread internal/librarian/librarian.go Outdated
Comment thread internal/librarian/golang/librarian.yaml Outdated
Comment thread internal/librarian/golang/librarian.yaml
Comment thread internal/librarian/golang/install.go Outdated
Comment thread internal/librarian/golang/install.go Outdated
Comment thread internal/librarian/golang/install.go Outdated
@sofisl sofisl requested a review from julieqiu April 17, 2026 20:06
Comment thread internal/librarian/golang/install.go Outdated
Comment thread internal/librarian/golang/install.go Outdated
Comment thread internal/librarian/golang/install.go
Comment thread internal/librarian/golang/install.go Outdated
Comment thread internal/librarian/golang/format.go Outdated
…-level variables, remove unnecessary check for embedded tools
@sofisl
Copy link
Copy Markdown
Contributor Author

sofisl commented Apr 17, 2026

Thanks for all the indepth reviews!

@sofisl sofisl merged commit 1a69322 into main Apr 17, 2026
32 checks passed
@sofisl sofisl deleted the addGoToolsToConfigTools branch April 17, 2026 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

golang: add Go tools to config.Tools and move golang dependencies from install.go

3 participants