Skip to content

Fix Go buildvcs error in Trixie build environment#622

Merged
hdwhdw merged 1 commit intosonic-net:masterfrom
sigabrtv1-ui:fix/trixie-buildvcs
Mar 18, 2026
Merged

Fix Go buildvcs error in Trixie build environment#622
hdwhdw merged 1 commit intosonic-net:masterfrom
sigabrtv1-ui:fix/trixie-buildvcs

Conversation

@sigabrtv1-ui
Copy link
Copy Markdown
Contributor

Description

Go 1.18+ enables VCS stamping by default (-buildvcs=true). In the sonic-buildimage dpkg build environment, the .git directory is not available, causing go install to fail with:

error obtaining VCS status: directory "." is not using a known version control system
Use -buildvcs=false to disable VCS stamping.

This was observed in the Trixie migration build: sonic-net/sonic-buildimage#25957

Fix

Set GOFLAGS += -buildvcs=false in debian/rules to disable VCS stamping during package builds.

Testing

  • Local sonic-buildimage VS image build with Trixie containers

Go 1.18+ enables VCS stamping by default via -buildvcs=true. In the
sonic-buildimage dpkg build environment, the .git directory is not
available, causing 'go install' to fail with:

  error obtaining VCS status: directory "." is not using a known
  version control system

Set GOFLAGS=-buildvcs=false in debian/rules to disable VCS stamping
during package builds.

Signed-off-by: Dawei Huang <daweihuang@microsoft.com>
@mssonicbld
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@hdwhdw hdwhdw requested review from Copilot and hdwhdw March 18, 2026 16:08
@hdwhdw hdwhdw marked this pull request as ready for review March 18, 2026 16:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates Debian packaging to disable Go’s default VCS stamping during builds, avoiding failures when the .git directory is not present (common in dpkg build environments like sonic-buildimage).

Changes:

  • Export GOFLAGS with -buildvcs=false in debian/rules to prevent VCS stamping during Debian package builds.

@hdwhdw hdwhdw merged commit 2a5d4c8 into sonic-net:master Mar 18, 2026
13 checks passed
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.

4 participants