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

add documentation and build script for Go wrapper #626

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

tangowithfoxtrot
Copy link
Contributor

Type of change

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

Objective

Add a build script for building the libs needed for the Go wrapper.

Code changes

  • languages/go/README.md: add a reference to the build script.
  • languages/go/build.sh: build the necessary dependencies for the Go wrapper.

Before you submit

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

@tangowithfoxtrot tangowithfoxtrot requested review from dani-garcia and a team February 22, 2024 17:13
Copy link

codecov bot commented Feb 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 59.50%. Comparing base (74eecad) to head (c046b53).
Report is 11 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #626      +/-   ##
==========================================
+ Coverage   59.40%   59.50%   +0.10%     
==========================================
  Files         171      171              
  Lines       10345    10416      +71     
==========================================
+ Hits         6145     6198      +53     
- Misses       4200     4218      +18     

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

@bitwarden-bot
Copy link

bitwarden-bot commented Feb 22, 2024

Logo
Checkmarx One – Scan Summary & Details84142a3f-3eac-4e2a-861a-4473d3cf39a6

New Issues

Severity Issue Source File / Package Checkmarx Insight
MEDIUM Unpinned Actions Full Length Commit SHA /release-cli.yml: 213 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...
MEDIUM Unpinned Actions Full Length Commit SHA /release-cli.yml: 139 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...
MEDIUM Unpinned Actions Full Length Commit SHA /release-cli.yml: 80 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...
MEDIUM Unpinned Actions Full Length Commit SHA /release-cli.yml: 63 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...

Fixed Issues

Severity Issue Source File / Package
MEDIUM Unpinned Actions Full Length Commit SHA /release-cli.yml: 213
MEDIUM Unpinned Actions Full Length Commit SHA /release-cli.yml: 80
MEDIUM Unpinned Actions Full Length Commit SHA /release-cli.yml: 72
MEDIUM Unpinned Actions Full Length Commit SHA /release-cli.yml: 63
MEDIUM Unpinned Actions Full Length Commit SHA /build-cli.yml: 176
MEDIUM Unpinned Actions Full Length Commit SHA /build-cli.yml: 88
MEDIUM Unpinned Actions Full Length Commit SHA /release-cli.yml: 139
MEDIUM Unpinned Actions Full Length Commit SHA /publish-ruby.yml: 117
MEDIUM Unpinned Actions Full Length Commit SHA /release-cli.yml: 207
MEDIUM Unpinned Actions Full Length Commit SHA /build-cli.yml: 339

languages/go/build.sh Outdated Show resolved Hide resolved

printf '%s\n\n' "Copying Go bindings to $GO_LIB_DIR..."
mkdir -p "$GO_LIB_DIR"
find target/debug -maxdepth 1 -type f -name "libbitwarden_c.*" -exec cp {} "$GO_LIB_DIR"/ \;
Copy link
Member

Choose a reason for hiding this comment

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

There's a reference to the target/debug dir here, which should be target/release when building in release mode.

Also, the libbitwarden_c.* wildcard copies four files for me (libbitwarden_c.{a,d,dylib,rlib}), while only the dylib seems to be needed on Mac.

I don't think the extra copies are necessarily a concern, but only *.dylib and *.a are in the gitignore file, so at the very least we should add the two other types to not clutter the working directory (*.d and *.rlib).

cargo build
fi

npm i && npm run schemas
Copy link
Member

Choose a reason for hiding this comment

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

We never want to run npm i, and ci would re-install every dependency. I suggest presuming the environment is. already bootstrapped like our other build scripts.

Comment on lines +5 to +14
check_command() {
if ! command -v "$1" &>/dev/null; then
printf '%s\n' "$1 is required to build locally. Please install $2."
exit 1
fi
}

check_command cargo Rust
check_command go Go
check_command npm Node.js
Copy link
Member

Choose a reason for hiding this comment

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

We generally presume the environment is correctly bootstraped. These checks can provide a false confidence since we don't validate the version of the scripts.

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.

None yet

4 participants