Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cdktf-provider-vault: Go Pkg Seems to be unusable - duplicate method #2907

Closed
1 task
Mercanuis opened this issue Jun 1, 2023 · 4 comments
Closed
1 task
Labels
bug Something isn't working language/golang pre-built providers Issues around pre-built providers managed at https://github.com/hashicorp/cdktf-repository-manager priority/important-soon High priority, to be worked on as part of our current release or the following one.

Comments

@Mercanuis
Copy link

Expected Behavior

Currently, am trying to learn and try to use the Vault Provider's Golang package for experimentation and prototyping of a new service I'm trying to build.

I was hoping to be able to use the provider and run code to try and generate a working package that can compile and be built

Actual Behavior

My team uses Bazel, to handle a central go.mod for all projects across the monorepo. The main use of it is to handle the dependency packages for all golang packages being used

We run the go mod tidy as a process to make sure the mod is updated and clean and I see this message stemming from go mod when pulling in the package dep per the documentation

INFO: Running command line: bazel-bin/go_mod_tidy
go: finding module for package github.com/cdktf/cdktf-provider-vault-go/vault
go: found github.com/cdktf/cdktf-provider-vault-go/vault in github.com/cdktf/cdktf-provider-vault-go/vault v1.0.2
go: github.com/org/project/subprojectdir/xxx/xxx-vault/cmd imports
	github.com/cdktf/cdktf-provider-vault-go/vault: github.com/cdktf/cdktf-provider-vault-go/[email protected]: parsing go.mod:
	module declares its path as: github.com/hashicorp/cdktf-provider-vault-go/vault
	        but was required as: github.com/cdktf/cdktf-provider-vault-go/vault

My first thought it to replace this with the declared path and change my mod. go mod works and everything looks okay but then I got this error when attempting to build the project with the dependencies pulled in

 ~/Workspaces/xxx/ bazel build //subprojectdir/xxx/xxx-vault/cmd:cmd
INFO: Analyzed target //ns/bote/bote-vault/cmd:cmd (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: /private/var/tmp/_bazel_xxx/7d39ed14ed4635a76aa230719a8d0c9e/external/com_github_hashicorp_cdktf_provider_vault_go_vault/BUILD.bazel:3:11: GoCompilePkg external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.a failed: (Exit 1): builder failed: error executing command (from target @com_github_hashicorp_cdktf_provider_vault_go_vault//:vault) bazel-out/darwin_arm64-opt-exec-2B5CBBC6-ST-e846b08c7501/bin/external/go_sdk/builder_reset/builder compilepkg -sdk external/go_sdk -installsuffix darwin_arm64 -src ... (remaining 33 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:15:2: duplicate method Count
	external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:45:2: other declaration of Count
external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:15:2: duplicate method SetCount
	external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:47:2: other declaration of SetCount
external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:2119:2: duplicate method Count
	external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:2128:2: other declaration of Count
external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:2119:2: duplicate method SetCount
	external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:2130:2: other declaration of SetCount
external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:2976:2: duplicate method Count
	external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:2985:2: other declaration of Count
external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:2976:2: duplicate method SetCount
	external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:2987:2: other declaration of SetCount
external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:3765:2: duplicate method Count
	external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:3777:2: other declaration of Count
external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:3765:2: duplicate method SetCount
	external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:3779:2: other declaration of SetCount
external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:4893:2: duplicate method Count
	external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:4904:2: other declaration of Count
external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:4893:2: duplicate method SetCount
	external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:4906:2: other declaration of SetCount
external/com_github_hashicorp_cdktf_provider_vault_go_vault/vault.go:4893:2: too many errors
compilepkg: error running subcommand external/go_sdk/pkg/tool/darwin_arm64/compile: exit status 2
Target //subprojectdir/xxx/xxx-vault/cmd:cmd failed to build

Steps to Reproduce

  1. Using the provided Gist run go mod tidy
  2. Run go build or if using bazel , can run the target that builds a go_library
  3. The output should be as above

Versions

 ~/Workspaces/xxx/ cdktf debug
cdktf debug
language: null
cdktf-cli: 0.16.1
node: v18.16.0
terraform: 1.4.6
arch: arm64
os: darwin 22.5.0

Providers

 ~/Workspaces/xxx/ cdktf provider list
Error
    at Object.External (/opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:94:41818)
    at np.read (/opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:153:2419)
    at Object.Qxr (/opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:498:32892)
    at Tp.handleCommand (/opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/bundle/bin/cdktf.js:54:895)
    at N.handler (/opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/bundle/bin/cdktf.js:53:30050)
    at /opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/node_modules/yargs/build/index.cjs:1:8993
    at j (/opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/node_modules/yargs/build/index.cjs:1:4956)
    at _.handleValidationAndGetResult (/opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/node_modules/yargs/build/index.cjs:1:8962)
    at _.applyMiddlewareAndGetResult (/opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/node_modules/yargs/build/index.cjs:1:9604)
    at _.runCommand (/opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/node_modules/yargs/build/index.cjs:1:7231)
Collecting Debug Information...
/opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
        throw ex;
        ^

Error
    at Object.External (/opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:94:41818)
    at np.read (/opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:153:2419)
    at Object.Qxr (/opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:498:32892)
    at Tp.handleCommand (/opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/bundle/bin/cdktf.js:54:895)
    at N.handler (/opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/bundle/bin/cdktf.js:53:30050)
    at /opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/node_modules/yargs/build/index.cjs:1:8993
    at j (/opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/node_modules/yargs/build/index.cjs:1:4956)
    at _.handleValidationAndGetResult (/opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/node_modules/yargs/build/index.cjs:1:8962)
    at _.applyMiddlewareAndGetResult (/opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/node_modules/yargs/build/index.cjs:1:9604)
    at _.runCommand (/opt/homebrew/Cellar/cdktf/0.16.1/libexec/lib/node_modules/cdktf-cli/node_modules/yargs/build/index.cjs:1:7231) {
  __type: 'External'
}

Node.js v18.16.0

Gist

https://gist.github.com/Mercanuis/c98fafbd270b6e1bab0bf35cc8fd8507

Workarounds

None yet, conversely trying to use the listed package on the documentation results in the following output stated above

Anything Else?

Bazel might be one possible factor. However, the way its set up in our project is simply using the golang toolchain's version of go mod go build etc.

 ~/Workspaces/xxx/ go version  
go version go1.20.4 darwin/arm64

References

No response

Help Wanted

  • I'm interested in contributing a fix myself

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
@Mercanuis Mercanuis added bug Something isn't working new Un-triaged issue pre-built providers Issues around pre-built providers managed at https://github.com/hashicorp/cdktf-repository-manager labels Jun 1, 2023
@Mercanuis
Copy link
Author

Follow up

Trying to add a 'replace' clause to the go.mod also seems to not rectify the problem even though it seems to be the main workaround per github.com//issues/2146

@DanielMSchmidt DanielMSchmidt added priority/important-soon High priority, to be worked on as part of our current release or the following one. and removed new Un-triaged issue labels Jun 9, 2023
@eahrend
Copy link

eahrend commented Oct 18, 2023

Hey, I had this issue not too long ago when upgrading from 0.16, can you check to see if following the steps in the link below works?

#2856 (comment)

@xiehan
Copy link
Member

xiehan commented Jan 12, 2024

We believe that the solution flagged in #2856 (comment) should also address this. If you're still having issues after trying that, please open a new bug report.

@xiehan xiehan closed this as not planned Won't fix, can't repro, duplicate, stale Jan 12, 2024
Copy link
Contributor

I'm going to lock this issue because it has been closed for 30 days. This helps our maintainers find and focus on the active issues. If you've found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working language/golang pre-built providers Issues around pre-built providers managed at https://github.com/hashicorp/cdktf-repository-manager priority/important-soon High priority, to be worked on as part of our current release or the following one.
Projects
None yet
Development

No branches or pull requests

4 participants