Trong 1 lần mình build image trên bitbucket pipeline thì nó bị lỗi này:
INFO[0020] Args: [-c GOOS=linux go build -o app] INFO[0020] Running: [/bin/sh -c GOOS=linux go build -o app] error obtaining VCS status: exit status 128 Use -buildvcs=false to disable VCS stamping. error building image: error building stage: failed to execute command: waiting for process to exit: exit status 1

The -buildvcs=false
flag in the go build
command is used to disable VCS (Version Control System) stamping during the build process. This flag is particularly useful in environments where the Go compiler might face issues accessing the version control metadata, such as when building Docker images in isolated environments like CI/CD pipelines.
Why Disable VCS Stamping with -buildvcs=false
?
- Build Environments: In CI/CD pipelines, especially when building Docker images, the build environment may not have access to the VCS metadata, leading to errors.
- Simpler Builds: Disabling VCS stamping can simplify the build process by avoiding the need for VCS metadata.
- Performance: It can slightly improve build performance by skipping the collection of VCS information.
How to disable VCS Stamping
Adding the -buildvcs=false
flag ensures that the build process does not fail due to missing VCS information.
refer to: https://www.reddit.com/r/golang/comments/x5e3ld/how_to_set_buildvcsfalse_as_default/
