mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-26 16:36:26 -06:00
go build
/ go install
should generate tofu
binary (#590)
This commit is contained in:
parent
2c01380709
commit
8465827f03
2
.github/workflows/build-opentofu-oss.yml
vendored
2
.github/workflows/build-opentofu-oss.yml
vendored
@ -62,7 +62,7 @@ jobs:
|
||||
instructions: |-
|
||||
mkdir dist out
|
||||
set -x
|
||||
go build -ldflags "${{ inputs.ld-flags }}" -o dist/ .
|
||||
go build -ldflags "${{ inputs.ld-flags }}" -o dist/ ./cmd/tofu
|
||||
zip -r -j out/${{ env.ARTIFACT_BASENAME }} dist/
|
||||
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
|
||||
with:
|
||||
|
2
.github/workflows/compare-snapshots.yml
vendored
2
.github/workflows/compare-snapshots.yml
vendored
@ -32,7 +32,7 @@ jobs:
|
||||
|
||||
- name: Build the OpenTofu binary
|
||||
run: |
|
||||
go build -o ./bin/tofu
|
||||
go build -o ./bin/tofu ./cmd/tofu
|
||||
|
||||
- name: Run the equivalence tests
|
||||
run: |
|
||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -18,7 +18,7 @@ website/node_modules
|
||||
*.test
|
||||
*.iml
|
||||
|
||||
/opentofu
|
||||
/tofu
|
||||
|
||||
website/vendor
|
||||
vendor/
|
||||
|
@ -10,6 +10,8 @@ builds:
|
||||
- env:
|
||||
- CGO_ENABLED=0
|
||||
|
||||
main: ./cmd/tofu
|
||||
|
||||
flags:
|
||||
- "-mod=readonly"
|
||||
- "-trimpath"
|
||||
@ -202,11 +204,11 @@ signs:
|
||||
- artifacts: checksum
|
||||
cmd: cosign
|
||||
certificate: "${artifact}.pem"
|
||||
args: ["sign-blob", "--oidc-issuer=https://token.actions.githubusercontent.com", "--output-certificate=${certificate}", "--output-signature=${signature}", "${artifact}", "--yes"]
|
||||
args: [ "sign-blob", "--oidc-issuer=https://token.actions.githubusercontent.com", "--output-certificate=${certificate}", "--output-signature=${signature}", "${artifact}", "--yes" ]
|
||||
|
||||
docker_signs:
|
||||
- artifacts: all
|
||||
args: ["sign", "--oidc-issuer=https://token.actions.githubusercontent.com", "${artifact}@${digest}", "--yes"]
|
||||
args: [ "sign", "--oidc-issuer=https://token.actions.githubusercontent.com", "${artifact}@${digest}", "--yes" ]
|
||||
|
||||
snapshot:
|
||||
name_template: "{{ .Version }}-next"
|
||||
|
@ -16,7 +16,7 @@ OpenTofu accepts certain options passed using `ldflags` at build time which cont
|
||||
OpenTofu will include a `-dev` flag when reporting its own version (ex: 1.5.0-dev) unless `version.dev` is set to `no`:
|
||||
|
||||
```
|
||||
go build -ldflags "-w -s -X 'github.com/opentofu/opentofu/version.dev=no'" -o bin/ .
|
||||
go build -ldflags "-w -s -X 'github.com/opentofu/opentofu/version.dev=no'" -o bin/ ./cmd/tofu
|
||||
```
|
||||
|
||||
### Experimental Features
|
||||
@ -24,7 +24,7 @@ go build -ldflags "-w -s -X 'github.com/opentofu/opentofu/version.dev=no'" -o bi
|
||||
Experimental features of OpenTofu will be disabled unless `main.experimentsAllowed` is set to `yes`:
|
||||
|
||||
```
|
||||
go build -ldflags "-w -s -X 'main.experimentsAllowed=yes'" -o bin/ .
|
||||
go build -ldflags "-w -s -X 'main.experimentsAllowed=yes'" -o bin/ ./cmd/tofu
|
||||
```
|
||||
|
||||
## Go Options
|
||||
|
@ -58,7 +58,7 @@ Switch into the root directory of the cloned repository and build OpenTofu using
|
||||
|
||||
```
|
||||
cd opentofu
|
||||
go install .
|
||||
go install ./cmd/tofu
|
||||
```
|
||||
|
||||
The first time you run the `go install` command, the Go toolchain will download any library dependencies that you don't already have in your Go modules cache. Subsequent builds will be faster because these dependencies will already be available on your local disk.
|
||||
|
@ -210,6 +210,7 @@ func setupBinary() func() {
|
||||
"build",
|
||||
"-o", tmpTerraformBinaryDir,
|
||||
"-ldflags", fmt.Sprintf("-X \"github.com/opentofu/opentofu/version.Prerelease=%s\"", tfversion.Prerelease),
|
||||
"./cmd/tofu",
|
||||
)
|
||||
err = cmd.Run()
|
||||
if err != nil {
|
||||
|
@ -48,7 +48,7 @@ func setup() func() {
|
||||
return func() {}
|
||||
}
|
||||
|
||||
tmpFilename := e2e.GoBuild("github.com/opentofu/opentofu", "tofu")
|
||||
tmpFilename := e2e.GoBuild("github.com/opentofu/opentofu/cmd/tofu", "tofu")
|
||||
|
||||
// Make the executable available for use in tests
|
||||
terraformBin = tmpFilename
|
||||
|
@ -59,7 +59,7 @@ gox \
|
||||
-osarch="${XC_EXCLUDE_OSARCH}" \
|
||||
-ldflags "${LD_FLAGS}" \
|
||||
-output "pkg/{{.OS}}_{{.Arch}}/tofu" \
|
||||
.
|
||||
./cmd/tofu
|
||||
|
||||
# Move all the compiled things to the $GOPATH/bin
|
||||
GOPATH=${GOPATH:-$(go env GOPATH)}
|
||||
|
Loading…
Reference in New Issue
Block a user