Well, my embarrassingly incorrect assumption came about from a package I 
was writing recently; I was using the go mod tool to initialize my go.mod 
rather than writing the file myself, and as an import statement I first 
tried using the local filepath, which of coarse didn't work. Then I tried 
things like: "." (yielding error: unknown import path 
"_/home/k/code/go/delete": internal error: module loader did not resolve 
import" upon build (but it let me initialize the module without issue). 
What finally did work, was when I used a GitHub repo URL that I created 
only for this purpose, which is what ultimately brought about my 
assumption. It never occurred to me to use a fictitious import path 
because, well, there is nothing there. 

So it was my mistake (*egg on my face ¯\_(ツ)_/¯)

But thx for the replies.

-K

On Friday, September 14, 2018 at 11:09:03 PM UTC-7, Jakob Borg wrote:
>
> I’m not sure I understand. My "go build" doesn’t reach out anywhere to 
> build a local program: 
>
> $ mkdir /tmp/project && cd /tmp/project/
>
> $ cat > main.go
> package main
>
> import "fmt"
>
> func main() { fmt.Println("Oi") }
>
> $ cat > go.mod
> module totally/fake/project
>
> $ go build
>
> $ ./project
> Oi
>
>
>
> On 15 Sep 2018, at 03:32, K Davidson <kde...@gmail.com <javascript:>> 
> wrote:
>
> I appologize if this has been asked before, I tried searching but all the 
> posts I could find of a similar nature were asking about dependencies, 
> rather than about the module specifically.
>
> Is it possible to have a package as a module without having it hosted 
> somewhere (like Github, or other internet endpoint?) 
>
> I often like to prototype ideas locally, but the idea usually isn't worth 
> all the effort of making a new repository, and all the work to set up git, 
> as most of the time I end up scrapping it. However with GO111MODULE=on, go 
> build seems to require a module line that is hosted at a url (ie: 
> github.com/kidoda/quikcam) in order to build. With dependencies I can 
> just use the -replace directive to point to a local directory, but I can't 
> seem to find a way to do the same with the module.
>
> Is there a way that I can build my package as a module without having to 
> host it on the internet?
>
> Thanks in advance,
>
> -K
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to golang-nuts...@googlegroups.com <javascript:>.
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to