Rename package
This commit is contained in:
parent
5dd95c9434
commit
2c0fb515da
8 changed files with 21 additions and 22 deletions
|
@ -3,7 +3,7 @@
|
|||
Cross platform (macOS/Linux/Windows/Android/iOS) clipboard package in Go
|
||||
|
||||
```go
|
||||
import "golang.design/x/clipboard"
|
||||
import "code.rocket9labs.com/tslocum/clipboard"
|
||||
```
|
||||
|
||||
## Features
|
||||
|
|
14
clipboard.go
14
clipboard.go
|
@ -53,7 +53,7 @@ clipboard data is changed, use the watcher API:
|
|||
println(string(data))
|
||||
}
|
||||
*/
|
||||
package clipboard // import "golang.design/x/clipboard"
|
||||
package clipboard // import "code.rocket9labs.com/tslocum/clipboard"
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
@ -85,8 +85,8 @@ var (
|
|||
// Due to the limitation on operating systems (such as darwin),
|
||||
// concurrent read can even cause panic, use a global lock to
|
||||
// guarantee one read at a time.
|
||||
lock = sync.Mutex{}
|
||||
initOnce sync.Once
|
||||
lock = sync.Mutex{}
|
||||
initOnce sync.Once
|
||||
initError error
|
||||
)
|
||||
|
||||
|
@ -95,10 +95,10 @@ var (
|
|||
// target system lacks required dependency, such as libx11-dev in X11
|
||||
// environment. For example,
|
||||
//
|
||||
// err := clipboard.Init()
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
// err := clipboard.Init()
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
//
|
||||
// If Init returns an error, any subsequent Read/Write/Watch call
|
||||
// may result in an unrecoverable panic.
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include <string.h>
|
||||
|
||||
#define LOG_FATAL(...) __android_log_print(ANDROID_LOG_FATAL, \
|
||||
"GOLANG.DESIGN/X/CLIPBOARD", __VA_ARGS__)
|
||||
"code.rocket9labs.com/tslocum/clipboard", __VA_ARGS__)
|
||||
|
||||
static jmethodID find_method(JNIEnv *env, jclass clazz, const char *name, const char *sig) {
|
||||
jmethodID m = (*env)->GetMethodID(env, clazz, name, sig);
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"golang.design/x/clipboard"
|
||||
"code.rocket9labs.com/tslocum/clipboard"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@ -124,7 +124,7 @@ func TestClipboard(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("text", func(t *testing.T) {
|
||||
data := []byte("golang.design/x/clipboard")
|
||||
data := []byte("code.rocket9labs.com/tslocum/clipboard")
|
||||
clipboard.Write(clipboard.FmtText, data)
|
||||
|
||||
b := clipboard.Read(clipboard.FmtImage)
|
||||
|
@ -155,7 +155,7 @@ func TestClipboardMultipleWrites(t *testing.T) {
|
|||
}
|
||||
chg := clipboard.Write(clipboard.FmtImage, data)
|
||||
|
||||
data = []byte("golang.design/x/clipboard")
|
||||
data = []byte("code.rocket9labs.com/tslocum/clipboard")
|
||||
clipboard.Write(clipboard.FmtText, data)
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*2)
|
||||
|
@ -250,7 +250,7 @@ func TestClipboardWatch(t *testing.T) {
|
|||
|
||||
changed := clipboard.Watch(ctx, clipboard.FmtText)
|
||||
|
||||
want := []byte("golang.design/x/clipboard")
|
||||
want := []byte("code.rocket9labs.com/tslocum/clipboard")
|
||||
go func(ctx context.Context) {
|
||||
t := time.NewTicker(time.Millisecond * 500)
|
||||
for {
|
||||
|
@ -287,7 +287,7 @@ func TestClipboardWatch(t *testing.T) {
|
|||
|
||||
func BenchmarkClipboard(b *testing.B) {
|
||||
b.Run("text", func(b *testing.B) {
|
||||
data := []byte("golang.design/x/clipboard")
|
||||
data := []byte("code.rocket9labs.com/tslocum/clipboard")
|
||||
|
||||
b.ReportAllocs()
|
||||
b.ResetTimer()
|
||||
|
|
|
@ -24,16 +24,15 @@
|
|||
//
|
||||
// - For desktop:
|
||||
//
|
||||
// go build -o gclip-gui
|
||||
// go build -o gclip-gui
|
||||
//
|
||||
// - For Android:
|
||||
//
|
||||
// gomobile build -v -target=android -o gclip-gui.apk
|
||||
// gomobile build -v -target=android -o gclip-gui.apk
|
||||
//
|
||||
// - For iOS:
|
||||
//
|
||||
// gomobile build -v -target=ios -bundleid design.golang.gclip-gui.app
|
||||
//
|
||||
// gomobile build -v -target=ios -bundleid design.golang.gclip-gui.app
|
||||
package main
|
||||
|
||||
import (
|
||||
|
@ -45,7 +44,7 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"golang.design/x/clipboard"
|
||||
"code.rocket9labs.com/tslocum/clipboard"
|
||||
|
||||
"golang.org/x/image/font"
|
||||
"golang.org/x/image/font/basicfont"
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"golang.design/x/clipboard"
|
||||
"code.rocket9labs.com/tslocum/clipboard"
|
||||
)
|
||||
|
||||
func usage() {
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
"fmt"
|
||||
"time"
|
||||
|
||||
"golang.design/x/clipboard"
|
||||
"code.rocket9labs.com/tslocum/clipboard"
|
||||
)
|
||||
|
||||
func ExampleWrite() {
|
||||
|
|
2
go.mod
2
go.mod
|
@ -1,4 +1,4 @@
|
|||
module golang.design/x/clipboard
|
||||
module code.rocket9labs.com/tslocum/clipboard
|
||||
|
||||
go 1.22.0
|
||||
|
||||
|
|
Loading…
Reference in a new issue