chore: remove clipboard package, do it ourselves. mac only#52
Merged
chore: remove clipboard package, do it ourselves. mac only#52
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR replaces the external clipboard package (which required cgo) with a mac-only pbcopy wrapper and updates build tasks accordingly.
- Adds a dependency on the
depstask before building. - Removes
golang.design/x/clipboard(and related indirect packages) fromgo.mod. - Implements a custom
pbcopycommand incmd/copy.gofor macOS only.
Reviewed Changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tasks.toml | Adds deps = [["deps"]] to ensure dependency tasks run |
| go.mod | Removes the clipboard package and other unused modules |
| cmd/copy.go | Removes clipboard import and adds pbcopy exec wrapper |
Comments suppressed due to low confidence (2)
cmd/copy.go:47
- [nitpick] Using
copyas a function name shadows the Go built-incopyfunction. Consider renaming it to something more descriptive likecopyToClipboard.
func copy(content []byte) error {
cmd/copy.go:58
- The new
pbcopyimplementation isn't covered by automated tests. Consider adding a test that mocksexec.Command, or abstracting the exec call to verify behavior without spawning a real process.
func pbcopy(content []byte) error {
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
turns out the clipboard package i was using required cgo. local builds on my mac worked fine, but ci builds on Ubuntu were broken. i quickly despised having to sort out the build crap for something so simple. this swaps the package for a home-rolled exec to pbcopy.
only supports mac for now, but there were wayland issues on linux already anyway.