golang-design / clipboard

📋 cross-platform clipboard package that supports accessing text and image in Go (macOS/Linux/Windows/Android/iOS)
https://golang.design/x/clipboard
MIT License
632 stars 68 forks source link

Backward compatibility for Go 1.16 #12

Closed FrankFang closed 3 years ago

FrankFang commented 3 years ago

Newbie here. When I ran commands below:

$ go version
go version go1.16.8 linux/amd64
$ go mod init main
$ touch main.go
$ go get -u golang.design/x/clipboard                                                                                                                                     ✘ 1 
//go:build comment without // +build comment
$ go run main                                                                                                                                                             ✘ 1 
main.go:4:8: no required module provides package golang.design/x/clipboard; to add it:
        go get golang.design/x/clipboard
$ go get golang.design/x/clipboard                                                                                                                                        ✘ 1 
//go:build comment without // +build comment

I got //go:build comment without // +build comment, but the go.mod file never changed. So how could I install golang-design/clipboard?

main.go

package main

import "fmt"
import "golang.design/x/clipboard"

func main(){
    fmt.Println("hi")
}
FrankFang commented 3 years ago

It works well for go 1.17. Just upgrade go!

changkun commented 3 years ago

Yes, starting from 0.5, the package requires 1.17. If you can only use 1.16, then 0.4.6 can be an option for you.

changkun commented 3 years ago

Reopen for backward compatibility in Go 1.16. Also because of golang/go#48509.