Not able to import package from git

Hi, I am new to GO. I was trying to import a package “pcap” for my application. I am using Visual studio code on windows 10 pc. The code is as Follows,

package main
import (
“fmt”
github.com/google/gopacket/pcap
)

func main() {
version := pcap.version()
fmt.Println(version)
}

But i am not able to get the expected result. An error is showing up as,

cannot find package “github.com/google/gopacket/pcap” in any of:

How can i resolve this issue?

It looks like you try to use this module. For me, go get works:

$ go get github.com/google/gopacket/pcap
go: downloading github.com/google/gopacket v1.1.17
go: found github.com/google/gopacket/pcap in github.com/google/gopacket v1.1.17

What does VSCode tell you after “in any of”?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.