jackpal / gateway

A golang library for discovering the address of a LAN gateway.
BSD 3-Clause "New" or "Revised" License
226 stars 69 forks source link

v1.0.9 build error on linux #37

Closed fengyc closed 1 year ago

fengyc commented 1 year ago

branch: v1.0.9 (v1.0.8 has no error) error:

go: downloading github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421
package client
    imports github.com/jackpal/gateway
    imports golang.org/x/net/route: build constraints exclude all Go files in /home/ubuntu/go/pkg/mod/golang.org/x/net@v0.8.0/route
jackpal commented 1 year ago

Sorry! It should be fixed in v1.0.10

Tested by successfully building and running on Google colab:

%%bash
add-apt-repository ppa:longsleep/golang-backports -y
apt update
apt install golang-go
mkdir -p hello
cd hello

cat << EOF > main.go
package main

import (
    "fmt"

    "github.com/jackpal/gateway"
)

func main() {
    gateway, err := gateway.DiscoverGateway()
    if err != nil {
        fmt.Println(err)
    } else {
        fmt.Println("Gateway:", gateway.String())
   }
}
EOF

go mod init example.com/hello
go mod tidy
go run -v main.go