gen2brain / beeep

Go cross-platform library for sending desktop notifications, alerts and beeps
BSD 2-Clause "Simplified" License
1.43k stars 89 forks source link

go install support #46

Closed ItsIgnacioPortal closed 2 years ago

ItsIgnacioPortal commented 2 years ago

Go get has been deprecated. Please update this repo to support go install

gen2brain commented 2 years ago

There is already support for Go modules, and there is nothing with main package that can be installed with go install. What support did you mean?

ItsIgnacioPortal commented 2 years ago

I mean "beeep" can no longer be installed using "go get" as the readme describes. The project needs to support "go install".

Also, I haven't been able to use this project, not even manually. How do you import it? can you provide an example that actually works? 😅

gen2brain commented 2 years ago

Well, no, it does not need to support go install. You use that to install the binary in GOPATH/bin, when there is a binary, this is a library. Ignore the go get part, you don't need to install anything before, just go mod init your project, import the library, and use it.

# cat example.go 
package main

import "github.com/gen2brain/beeep"

func main() {
    err := beeep.Notify("Title", "Message body", "")
    if err != nil {
        panic(err)
    }
}

# go mod init example
go: creating new go.mod: module example
go: to add module requirements and sums:
    go mod tidy

# go mod tidy
go: finding module for package github.com/gen2brain/beeep
go: found github.com/gen2brain/beeep in github.com/gen2brain/beeep v0.0.0-20220402123239-6a3042f4b71a

# go build
# ./example

This is pretty much what you would use for any other library, nothing specific about this one.