Velocidex / go-ese

Go implementation of an Extensible Storage Engine parser
Apache License 2.0
26 stars 12 forks source link

Fix module name in go.mod #14

Closed dzonerzy closed 2 years ago

dzonerzy commented 2 years ago

go-ese declare its path as www.velocidex.com/golang/go-ese plase update it to match the current path as github.com/Velocidex/go-ese

scudette commented 2 years ago

That is the correct mod path.

dzonerzy commented 2 years ago

I'm having this issue https://gyazo.com/8e060a2359142de25ce55515cbf40fb2

scudette commented 2 years ago

Indeed you are importing it as github.com/Velocidex/go-ese but that is not the module import path - you need to import it as www.velocidex.com/golang/go-ese:

import "www.velocidex.com/golang/go-ese/parser"

See here for an example https://github.com/Velocidex/velociraptor/blob/63f122ec157a1372eafecfd8d90f2b5c86c80a84/vql/parsers/ese/ese.go#L27

dzonerzy commented 2 years ago

That implies that i have to go get www.velocidex.com/golang/go-ese but since this project is hosted on github that makes no sense to me

scudette commented 2 years ago

In Go, where a package is hosted has nothing to do with the import path.

https://pkg.go.dev/cmd/go#hdr-Remote_import_paths

dzonerzy commented 2 years ago

The docs specify that certain sites like github use specific import path:

GitHub (Git)

import "github.com/user/project"
import "github.com/user/project/sub/directory"
scudette commented 2 years ago

Yes that is how you can reference code on Github but you dont have to - the docs go on to explain

If the import path is not a known code hosting site and also lacks a version control qualifier, the go tool attempts to fetch the import over https/http and looks for a <meta> tag in the document's HTML <head>.

The meta tag has the form:

<meta name="go-import" content="import-prefix vcs repo-root">
The import-prefix is the import path corresponding to the repository root. It must be a prefix or an exact match of the package being fetched with "go get". If it's not an exact match, another http request is made at the prefix to verify the <meta> tags match.

The advantage of this is that it is easy to switch to another hosting site (e.g. Gitlab, bitbucket etc) without having to change all the callsites so that is why we do it for all our packages.