Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

build constraints exclude all Go files in

Tags:

go

when import "golang.org/x/net/route"

it tells "build constraints exclude all Go files in go/src/golang.org/x/net/routego"

I am using VSCode editor on Windows/Linux

I searched online and didn't see a solution to the similar problem

package main

import (
    "golang.org/x/net/route"
)

{
    rib, _ := route.FetchRIB(0, route.RIBTypeRoute, 0)
    messages, err := route.ParseRIB(route.RIBTypeRoute, rib)
}
like image 904
jerry Avatar asked Mar 26 '19 01:03

jerry


2 Answers

We met the same error under Goland, and it could be solved in this way

If you want to set GOOS = linux under Mac, just add this line in the header of file // +build linux,amd64,go1.15,!cgo which means we declare that this file is for the target system that has the following requirements: Linux, the AMD64 architecture, the 1.15 Go version, and no CGO support.

like image 73
zangw Avatar answered Sep 19 '22 19:09

zangw


try to remove folder x in go/src/golang.org/

like image 32
RK26 Avatar answered Sep 20 '22 19:09

RK26