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

[SM-1223] restructure Go wrapper for distribution #647

Closed
wants to merge 23 commits into from

Conversation

tangowithfoxtrot
Copy link
Contributor

@tangowithfoxtrot tangowithfoxtrot commented Mar 1, 2024

Type of change

  • Bug fix
  • New feature development
  • Tech debt (refactoring, code cleanup, dependency upgrades, etc)
  • Build/deploy pipeline (DevOps)
  • Other

Objective

Restructure the Go wrapper so that it works when consumed as a package. The current structure uses "internal" Go modules, which will throw errors when you try to use them:

/go/pkg/mod/github.com/bitwarden/sm-sdk-go@v0.1.0/bitwarden_client.go:6:2: use of internal package github.com/bitwarden/sdk/languages/go/internal/cinterface not allowed

Code changes

  • file.ext: Description of what was changed and why

Before you submit

  • Please add unit tests where it makes sense to do so

@bitwarden-bot
Copy link

bitwarden-bot commented Mar 1, 2024

Logo
Checkmarx One – Scan Summary & Detailsa5134412-489b-45ab-a21e-089c460785d5

New Issues

Severity Issue Source File / Package Checkmarx Insight
MEDIUM Unpinned Actions Full Length Commit SHA /release-go.yml: 62 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...

Copy link

codecov bot commented Mar 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.53%. Comparing base (621cb48) to head (eb4f89a).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #647   +/-   ##
=======================================
  Coverage   60.53%   60.53%           
=======================================
  Files         172      172           
  Lines       10527    10527           
=======================================
  Hits         6373     6373           
  Misses       4154     4154           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -3,7 +3,7 @@ package sdk
import (
"encoding/json"

"github.com/bitwarden/sdk/languages/go/internal/cinterface"
"github.com/bitwarden/sm-sdk-go/cinterface"
Copy link
Member

Choose a reason for hiding this comment

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

The internal package was intentional, to limit the external APIs and reduce the surface for major versions. The cinterface should not be exposed externally. The reason this doesn't work is because you are trying to import it from the sm-sdk-go repository and it's loading two different packages.

@Hinton
Copy link
Member

Hinton commented Mar 4, 2024

We also don't want to distribute the lib files in a repository unless we force puch every release. Since with the binaries occupying 30mb+ we can expect the repository size to quickly become unreasonable.

@tangowithfoxtrot
Copy link
Contributor Author

We also don't want to distribute the lib files in a repository unless we force puch every release. Since with the binaries occupying 30mb+ we can expect the repository size to quickly become unreasonable.

That makes sense, but what's the alternative? Would we require people that want to import our Go wrapper to build the libs from source?

@differsthecat differsthecat changed the title restructure Go wrapper for distribution [SM-1223] restructure Go wrapper for distribution Apr 30, 2024
@sylwit
Copy link

sylwit commented May 26, 2024

I'm working on adding Bitwarden secrets manager as a provider to external secret operator for k8s and not being able to use this sdk as a package is a real deal breaker.

Do you have any recommendations on how this should be used in a multi architecture environment?

And the go example doesn't work, the Command struct is not imported

Thank you

@sylwit sylwit mentioned this pull request May 26, 2024
1 task
@tangowithfoxtrot tangowithfoxtrot deleted the fix-go-structure branch June 13, 2024 20:35
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.

5 participants