[go-nuts] Is it possible to segment CMD window on Windows and segment Terminal window on Linux with golang?

2020-04-09 Thread 洪嘉鴻
Hello everyone:
I use golang with Win10. I want to build executables which can segment 
terminal window and show different messages on different windows.
Besides, I also want the code can also cross-compile for Linux so that it 
is convenient to maintain.
Is it possible to segment CMD window on Windows and segment Terminal window 
on Linux with golang?

Any help is appreciated.
Thank you very much!
Max

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/6b4c23e0-8dee-49c4-9c44-fc811f3769bd%40googlegroups.com.


Re: [go-nuts] go commands hang indefinitely

2020-04-09 Thread Kurtis Rader
FWIW, I'm using Go 1.14.1 on macOS Catalina (10.15.4) without issue. The
one thing that seems weird in the information you provided is "GOBIN=/bin".
Since /bin shouldn't be writable by you that should fail if you attempt a
"go install". But that shouldn't affect a simple "go build". Also, having
more than one path in "GOPATH" shouldn't cause any problems but is somewhat
unusual.

My first guess is your environment has done something unusual with respect
to how signals are handled. See "man execve". Note that signals blocked at
the time a new process is started remain blocked. And ignored signals
remain ignored unless the new process explicitly handles the signal.
Unfortunately I don't know how to interrogate the signal disposition for a
process on macOS since it doesn't have /proc and lldb doesn't appear to
have a (simple) way to provide that info for a process.

On Thu, Apr 9, 2020 at 5:16 PM Juan Monroy-Nieto 
wrote:

> Hello everyone, I am compelled to stop just lurking.
>
> Go Version 1.14.1 on MacOS Mohave.
>
> Similarly to a recent post
> ,
> commands go build/vet/test/run hang indefinitely for any program including
> a hello world inside the GOPATH (copy pasted the code from the starting
> point in the playground). All the code I can test in the playground and in
> another mac runs fine. Unlike the cited post, this does not relate to
> internet connectivity. I have already posted this *issue
> *
> in StackOverflow to no avail. So I would like to ask for your help with
> this issue. I appreciate your help.
>
>  I have tried troubleshooting by:
>
>- Resetting GOPATH
>- Starting a shell without my bashRC
>- Restarting my computer
>- Reinstalling Go
>- Running go build -x yields normal calls and even an executable that
>runs fine (Last output is rm -r $WORK/b001/). It just does not exit,
>and ignores interrupt signals.
>- When it is running, a stack trace using *dtruss* shows ongoing
>syscalls that I am unable to interpret.
>
> My go env output:
>
>
> GO111MODULE=""
> GOARCH="amd64"
> GOBIN="/bin"
> GOCACHE="/Users/user_name/Library/Caches/go-build"
> GOENV="/Users/user_name/Library/Application Support/go/env"
> GOEXE=""
> GOFLAGS=""
> GOHOSTARCH="amd64"
> GOHOSTOS="darwin"
> GOINSECURE=""
> GONOPROXY=""
> GONOSUMDB=""
> GOOS="darwin"
> GOPATH="/Users/user_name/go:/Users/user_name/goCode"
> GOPRIVATE=""
> GOPROXY="https://proxy.golang.org,direct";
> GOROOT="/usr/local/go"
> GOSUMDB="sum.golang.org"
> GOTMPDIR=""
> GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
> GCCGO="gccgo"
> AR="ar"
> CC="clang"
> CXX="clang++"
> CGO_ENABLED="1"
> GOMOD=""
> CGO_CFLAGS="-g -O2"
> CGO_CPPFLAGS=""
> CGO_CXXFLAGS="-g -O2"
> CGO_FFLAGS="-g -O2"
> CGO_LDFLAGS="-g -O2"
> PKG_CONFIG="pkg-config"
> GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments
> -fmessage-length=0
> -fdebug-prefix-map=/var/folders/6c/h189_j9s6tdbj_kw24g2kvchsk0515/T/go-build628238008=/tmp/go-build
> -gno-record-gcc-switches -fno-common"
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/81548479-6676-4594-a0ba-6890003bafda%40googlegroups.com
> 
> .
>


-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CABx2%3DD8Nsek5HEoVyp2KqrtcoY%2BBtu9HgCaAxQhhRFAx46tDfg%40mail.gmail.com.


Re: [go-nuts] go commands hang indefinitely

2020-04-09 Thread Steven Hartland
What happens if you kill -ABRT the process?

On Fri, 10 Apr 2020 at 01:16, Juan Monroy-Nieto 
wrote:

> Hello everyone, I am compelled to stop just lurking.
>
> Go Version 1.14.1 on MacOS Mohave.
>
> Similarly to a recent post
> ,
> commands go build/vet/test/run hang indefinitely for any program including
> a hello world inside the GOPATH (copy pasted the code from the starting
> point in the playground). All the code I can test in the playground and in
> another mac runs fine. Unlike the cited post, this does not relate to
> internet connectivity. I have already posted this *issue
> *
> in StackOverflow to no avail. So I would like to ask for your help with
> this issue. I appreciate your help.
>
>  I have tried troubleshooting by:
>
>- Resetting GOPATH
>- Starting a shell without my bashRC
>- Restarting my computer
>- Reinstalling Go
>- Running go build -x yields normal calls and even an executable that
>runs fine (Last output is rm -r $WORK/b001/). It just does not exit,
>and ignores interrupt signals.
>- When it is running, a stack trace using *dtruss* shows ongoing
>syscalls that I am unable to interpret.
>
> My go env output:
>
>
> GO111MODULE=""
> GOARCH="amd64"
> GOBIN="/bin"
> GOCACHE="/Users/user_name/Library/Caches/go-build"
> GOENV="/Users/user_name/Library/Application Support/go/env"
> GOEXE=""
> GOFLAGS=""
> GOHOSTARCH="amd64"
> GOHOSTOS="darwin"
> GOINSECURE=""
> GONOPROXY=""
> GONOSUMDB=""
> GOOS="darwin"
> GOPATH="/Users/user_name/go:/Users/user_name/goCode"
> GOPRIVATE=""
> GOPROXY="https://proxy.golang.org,direct";
> GOROOT="/usr/local/go"
> GOSUMDB="sum.golang.org"
> GOTMPDIR=""
> GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
> GCCGO="gccgo"
> AR="ar"
> CC="clang"
> CXX="clang++"
> CGO_ENABLED="1"
> GOMOD=""
> CGO_CFLAGS="-g -O2"
> CGO_CPPFLAGS=""
> CGO_CXXFLAGS="-g -O2"
> CGO_FFLAGS="-g -O2"
> CGO_LDFLAGS="-g -O2"
> PKG_CONFIG="pkg-config"
> GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments
> -fmessage-length=0
> -fdebug-prefix-map=/var/folders/6c/h189_j9s6tdbj_kw24g2kvchsk0515/T/go-build628238008=/tmp/go-build
> -gno-record-gcc-switches -fno-common"
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/81548479-6676-4594-a0ba-6890003bafda%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAHEMsqaB-1HZvoDSNY-R9J8spmJ_X0%2BGFHqGy79s6sn2-sUH7w%40mail.gmail.com.


[go-nuts] go commands hang indefinitely

2020-04-09 Thread Juan Monroy-Nieto
Hello everyone, I am compelled to stop just lurking.

Go Version 1.14.1 on MacOS Mohave.

Similarly to a recent post 
,
 
commands go build/vet/test/run hang indefinitely for any program including 
a hello world inside the GOPATH (copy pasted the code from the starting 
point in the playground). All the code I can test in the playground and in 
another mac runs fine. Unlike the cited post, this does not relate to 
internet connectivity. I have already posted this *issue 
*
 
in StackOverflow to no avail. So I would like to ask for your help with 
this issue. I appreciate your help.

 I have tried troubleshooting by:

   - Resetting GOPATH
   - Starting a shell without my bashRC
   - Restarting my computer
   - Reinstalling Go 
   - Running go build -x yields normal calls and even an executable that 
   runs fine (Last output is rm -r $WORK/b001/). It just does not exit, and 
   ignores interrupt signals.
   - When it is running, a stack trace using *dtruss* shows ongoing 
   syscalls that I am unable to interpret.

My go env output:


GO111MODULE=""
GOARCH="amd64"
GOBIN="/bin"
GOCACHE="/Users/user_name/Library/Caches/go-build"
GOENV="/Users/user_name/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/user_name/go:/Users/user_name/goCode"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct";
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments 
-fmessage-length=0 
-fdebug-prefix-map=/var/folders/6c/h189_j9s6tdbj_kw24g2kvchsk0515/T/go-build628238008=/tmp/go-build
 
-gno-record-gcc-switches -fno-common"

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/81548479-6676-4594-a0ba-6890003bafda%40googlegroups.com.


Re: [go-nuts] Getting this error: compile: version "go1.13.7" does not match go tool version "go1.12.10"

2020-04-09 Thread Kurtis Rader
On Thu, Apr 9, 2020 at 12:51 PM Alexander Mills 
wrote:

> my go version is:
>
>
> *go version go1.12.10 linux/amd64*
>
> but when I run
>
>
> go run .
>
> *I get this horrendous error that makes no sense:*
>
> # math/bits
> compile: version "go1.13.7" does not match go tool version "go1.12.10"
>
>
>From https://github.com/golang/go/issues/22814:

"The error is telling you that you have a weird mix of Go versions on top
of one another, or mixed up together in your $PATH."

What does "go env" report? Especially the value of GOROOT.

-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CABx2%3DD_x3Nm0Smq3yQEQ9zU6ekU5%3DnqQPj0T1y%3DY-oJ%2BkDOFMQ%40mail.gmail.com.


Re: [go-nuts] Re: go run requires internet connection?

2020-04-09 Thread David Riley
I feel like it's 10.15 where Apple really started doubling down on their 
"notarization" service? I haven't updated anything to it because it breaks (by 
design) a number of things I regularly use, so it would be hard to say, but 
that has to be frustrating for developers who can't be constantly online.


- Dave


> On Apr 9, 2020, at 7:54 AM, Michael Jones  wrote:
> 
> Unable to reproduce the issue on MacOS Mojave 10.14.6, though I tried with 
> gusto.
> 
> On Thu, Apr 9, 2020 at 4:32 AM Tanmay Das  wrote:
> Thanks, everyone for your valuable comments. I think Brain is right. It might 
> be an OS-related issue. I really like how active this group is. I look 
> forward to coming back with more topics in the future. Stay Home. Stay Safe.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/9A9C1172-116D-4B73-B799-6E9FF0E41EA3%40gmail.com.


[go-nuts] Getting this error: compile: version "go1.13.7" does not match go tool version "go1.12.10"

2020-04-09 Thread Alexander Mills
I have this go.mod file:

module github.com/channelmeter/err-id-checker

go 1.12



my go version is:

*go version go1.12.10 linux/amd64
*


my imports just look like this:

package main

import (
 "bufio"
 "fmt"
 "io/ioutil"
 "log"
 "os"
 "path/filepath"
 "regexp"
 "strings"
 "sync"
)


but when I run 

go run .

*I get this horrendous error that makes no sense:*

# math/bits
compile: version "go1.13.7" does not match go tool version "go1.12.10"
# unicode
compile: version "go1.13.7" does not match go tool version "go1.12.10"
# internal/race
compile: version "go1.13.7" does not match go tool version "go1.12.10"
# unicode/utf8
compile: version "go1.13.7" does not match go tool version "go1.12.10"
# runtime/internal/sys
compile: version "go1.13.7" does not match go tool version "go1.12.10"
# sync/atomic
compile: version "go1.13.7" does not match go tool version "go1.12.10"
# runtime/internal/atomic
compile: version "go1.13.7" does not match go tool version "go1.12.10"
# internal/cpu
compile: version "go1.13.7" does not match go tool version "go1.12.10"


excuse my language but what the fuck is it doing? anyone know? I am on the 
right go version and my go.mod file requires the same go version.



-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/75b9b5e6-7a50-4223-9353-8e4a88ab3a2c%40googlegroups.com.


[go-nuts] Re: go run requires internet connection?

2020-04-09 Thread Ronny Bangsund


On Thursday, April 9, 2020 at 1:01:31 PM UTC+2, Tanmay Das wrote:
>
> Running the executable: `./helloworld`
>
Maybe there's a log entry for your program specifically in Console (the GUI 
collecting macOS logs), or in one of the system logs.

If this is somehow related to GateKeeper, you could try making an exception 
for it:
spctl --add helloworld
(You'll get a popup to enter the admin password.)

Or removing all attributes:
xattr -d 

Although I'm not sure the last option will do much :)

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/4fb656e2-2600-41de-a298-d74f628d7a00%40googlegroups.com.


[go-nuts] Re: godoc (golang.org/x/tools/cmd/godoc) has become module-aware

2020-04-09 Thread Nelo Mitranim
Trying and failing to use this. Help would be appreciated.

I'm working on a library module outside of GOPATH. The `go.mod` file is 
present. The `go` commands such as `go test` seem to run in module mode. 
But when I run `godoc -http=:6060`, it shows the standard library + 
packages from GOPATH, failing to include the current module. I've updated 
`godoc` via:

go get -u golang.org/x/tools/cmd/godoc

However I'm unable to check the installed `godoc` version, as it lacks such 
a subcommand, so I can't be sure if the installed version actually includes 
module support. The documentation doesn't give examples or mention modules 
at all. Any suggestions?

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/8897eda1-db92-405d-b4fc-a98f693b2619%40googlegroups.com.


Re: [go-nuts] go run requires internet connection?

2020-04-09 Thread Personal



> On 8 Apr 2020, at 20.00, Tanmay Das  wrote:
> 
> Hey Gophers,
> My very first post here.
> 
> Today I faced an unexpected power outage and I wanted to tinker with Go a 
> little bit. I wrote a simple hello world program and ran
> go run helloworld.go
> 
> Strangely the code didn't run. In fact, the terminal prompt never exited. I 
> kept running the same command over and over again but no luck. I checked all 
> my configurations, my env vars, etc. and everything was ok. After ruling out 
> all the possibilities it suddenly hit me: what if Go actually requires an 
> internet connection to run a program for no apparent reason? I waited for the 
> electricity to come back and as soon as I was connected to the internet I ran 
> `go run` command again and voilà! 
> 

Can you attach the output of `go env` and your working directory?  I am curious 
because I may have another issue that may related to this.  Thank you.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/FAC92664-B7E3-427D-AFFF-3BDDA2791EF2%40gmail.com.


Re: [go-nuts] Re: go run requires internet connection?

2020-04-09 Thread Michael Jones
Unable to reproduce the issue on MacOS Mojave 10.14.6, though I tried with
gusto.

On Thu, Apr 9, 2020 at 4:32 AM Tanmay Das  wrote:

> Thanks, everyone for your valuable comments. I think Brain is right. It
> might be an OS-related issue. I really like how active this group is. I
> look forward to coming back with more topics in the future. Stay Home. Stay
> Safe.
>
> On Wednesday, April 8, 2020 at 10:17:36 PM UTC+6, Tanmay Das wrote:
>>
>> Hey Gophers,
>> My very first post here.
>>
>> Today I faced an unexpected power outage and I wanted to tinker with Go a
>> little bit. I wrote a simple hello world program and ran
>> go run helloworld.go
>>
>> Strangely the code didn't run. In fact, the terminal prompt never exited.
>> I kept running the same command over and over again but no luck. I checked
>> all my configurations, my env vars, etc. and everything was ok. After
>> ruling out all the possibilities it suddenly hit me: what if Go actually
>> requires an internet connection to run a program for no apparent reason? I
>> waited for the electricity to come back and as soon as I was connected to
>> the internet I ran `go run` command again and voilà!
>>
>> Is this behavior expected? If it is, why did the go authors make such a
>> decision? I mean making the internet connectivity a dependency for the
>> execution of a program sounds counter-productive to me, honestly. :(
>>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/8fc3b552-f5c4-43de-94ba-4e0d4511f79a%40googlegroups.com
> 
> .
>


-- 

*Michael T. jonesmichael.jo...@gmail.com *

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CALoEmQyTgSTRDROSmgmKQAtJCzACv-aHPn7165tPjg0QVR-Smg%40mail.gmail.com.


[go-nuts] Re: go run requires internet connection?

2020-04-09 Thread Tanmay Das
Thanks, everyone for your valuable comments. I think Brain is right. It 
might be an OS-related issue. I really like how active this group is. I 
look forward to coming back with more topics in the future. Stay Home. Stay 
Safe.

On Wednesday, April 8, 2020 at 10:17:36 PM UTC+6, Tanmay Das wrote:
>
> Hey Gophers,
> My very first post here.
>
> Today I faced an unexpected power outage and I wanted to tinker with Go a 
> little bit. I wrote a simple hello world program and ran 
> go run helloworld.go
>
> Strangely the code didn't run. In fact, the terminal prompt never exited. 
> I kept running the same command over and over again but no luck. I checked 
> all my configurations, my env vars, etc. and everything was ok. After 
> ruling out all the possibilities it suddenly hit me: what if Go actually 
> requires an internet connection to run a program for no apparent reason? I 
> waited for the electricity to come back and as soon as I was connected to 
> the internet I ran `go run` command again and voilà! 
>
> Is this behavior expected? If it is, why did the go authors make such a 
> decision? I mean making the internet connectivity a dependency for the 
> execution of a program sounds counter-productive to me, honestly. :(
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/8fc3b552-f5c4-43de-94ba-4e0d4511f79a%40googlegroups.com.


[go-nuts] Re: go run requires internet connection?

2020-04-09 Thread Tanmay Das

>
> Therefore, I think it must be some issue with macOS being told to run an 
> executable it hasn't seen before, making a network connection.
>
You are probably right.

>  If you run it once successfully, and then remove the network connection, 
> does it run again OK?

It does. 

On Thursday, April 9, 2020 at 5:11:04 PM UTC+6, Brian Candler wrote:
>
> On Thursday, 9 April 2020 12:01:31 UTC+1, Tanmay Das wrote:
>>
>> Running the executable: `./helloworld`
>>
>>
> OK, then clearly it's not an issue with finding our downloading 
> dependencies: these will all have been resolved by the time the binary has 
> been compiled and linked.
>
> Therefore, I think it must be some issue with macOS being told to run an 
> executable it hasn't seen before, making a network connection.
>
> If you run it once successfully, and then remove the network connection, 
> does it run again OK?  (I would hope that it caches the result)
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/f84cb807-a4e3-4616-9aa1-c1a533e7822d%40googlegroups.com.


[go-nuts] Re: go run requires internet connection?

2020-04-09 Thread Brian Candler
On Thursday, 9 April 2020 12:01:31 UTC+1, Tanmay Das wrote:
>
> Running the executable: `./helloworld`
>
>
OK, then clearly it's not an issue with finding our downloading 
dependencies: these will all have been resolved by the time the binary has 
been compiled and linked.

Therefore, I think it must be some issue with macOS being told to run an 
executable it hasn't seen before, making a network connection.

If you run it once successfully, and then remove the network connection, 
does it run again OK?  (I would hope that it caches the result)

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/9a1ba436-1c7a-448e-bb3b-b6dd597066bc%40googlegroups.com.


[go-nuts] Re: go run requires internet connection?

2020-04-09 Thread Tanmay Das
Running the executable: `./helloworld`

Also note that, before building the executable, I tried running with `go 
run`, which of course, failed. I can't even say "Failed" because the go 
compiler was not throwing any error like *Hey, since I need to download 
some dependencies even though your program doesn't have one, you might 
wanna try running the program later.* The cursor just stuck in the terminal 
for eternity. I had to quit it with Ctrl + C.

On Thursday, April 9, 2020 at 4:15:50 PM UTC+6, Brian Candler wrote:
>
> On Thursday, 9 April 2020 06:15:22 UTC+1, Tanmay Das wrote:
>
>> I also forgot to mention one thing. I was able to build the program using 
>> go build. Even the executable was there. It just didn't run until I 
>> connected to internet.
>>
>>
> When you say "it just didn't run", do you mean with "go run ...", or 
> directly running the executable that you just built?
>
> If running the already-built executable hung, then I can only guess that 
> Apple are using a central service to check the fingerprints of executables 
> that haven't been seen before.  It would be interesting to run tcpdump at 
> the same time, to see if it's trying to do DNS lookups for some Apple 
> server.
>
> I also remember there are settings where you can send Apple information 
> about which applications you run (e.g. Preferences > Security & Privacy > 
> Privacy > Analytics > Share Mac Analytics).  But I'd be surprised if it did 
> that *before* the application started.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/a8ba39d2-c874-42e1-a256-46ae77cd2e11%40googlegroups.com.


[go-nuts] Re: go run requires internet connection?

2020-04-09 Thread Brian Candler
On Thursday, 9 April 2020 06:15:22 UTC+1, Tanmay Das wrote:

> I also forgot to mention one thing. I was able to build the program using 
> go build. Even the executable was there. It just didn't run until I 
> connected to internet.
>
>
When you say "it just didn't run", do you mean with "go run ...", or 
directly running the executable that you just built?

If running the already-built executable hung, then I can only guess that 
Apple are using a central service to check the fingerprints of executables 
that haven't been seen before.  It would be interesting to run tcpdump at 
the same time, to see if it's trying to do DNS lookups for some Apple 
server.

I also remember there are settings where you can send Apple information 
about which applications you run (e.g. Preferences > Security & Privacy > 
Privacy > Analytics > Share Mac Analytics).  But I'd be surprised if it did 
that *before* the application started.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/1f3ad08f-27bd-422f-8f7b-a792f048f527%40googlegroups.com.


[go-nuts] Re: printing all errors from stdlib as they happen

2020-04-09 Thread Brian Candler
Do you mean the line number *in the library function* ??

In general, I think that's an impossible problem.  Consider a somewhat 
convoluted example of a library function:


func Bar(...) {
...
if xyz() {
blah = true
}
if abc() {
baz = false
}
...
if blah && flurble() && !baz {
err = SomeError   // A
}
...
...
if err {
return 0, err // B
}
...
}

At what point was it "decided" that SomeError should be returned?  A number 
of conditions had to be met before line A was executed.  If you modified 
the code there, it could record as part of the error value the line number 
at which the err variable was set.  However without modifying the code (or 
changing the language, so that every variable value remembers the line 
number where it was last set), I think the best you could get is the line 
number of B.  And that's not very useful.

Your own code presumably looks something like this:

foo, err := library.Bar(baz)
if err {
...
}

This means you already know exactly which function you're calling; the 
error must have "come from" somewhere in that function.  (Of course, that 
function may have used the results from other functions before deciding to 
return an error)

There are only a fixed number of return points from library.Bar - quite 
possible only one.  Would it really help much to know which "return" 
statement was used?

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/499ac966-374b-4e3f-9ea7-729c8c1640f0%40googlegroups.com.


[go-nuts] Re: go run requires internet connection?

2020-04-09 Thread Tanmay Das
Hmm, it makes sense. Still, there should be some caching mechanism. If the 
internet connection can't be established, load the dep from the cache.

On Thursday, April 9, 2020 at 1:14:33 PM UTC+6, Volker Dobler wrote:
>
> On Wednesday, 8 April 2020 18:17:36 UTC+2, Tanmay Das wrote:
>>
>> Is this behavior expected? If it is, why did the go authors make such a 
>> decision? I mean making the internet connectivity a dependency for the 
>> execution of a program sounds counter-productive to me, honestly. :(
>>
>
> Well, go run does not just execute a program. It compiles
> the program und executes the compiled binary. The execution
> part doesn't need any internet connectivity, but the compilation
> step _might_ need one of some dependencies are not available.
> This is one of the many problems with go run.
>
> But note that this is the case for each and every language:
> You cannot run Java, C#, Rust, FORTRAN, R, whatnot code
> if dependencies are missing and not retrievable.
>
> V. 
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/891f159c-8bf2-4c73-98b3-98fd75174bcf%40googlegroups.com.


[go-nuts] Re: go run requires internet connection?

2020-04-09 Thread Volker Dobler
On Wednesday, 8 April 2020 18:17:36 UTC+2, Tanmay Das wrote:
>
> Is this behavior expected? If it is, why did the go authors make such a 
> decision? I mean making the internet connectivity a dependency for the 
> execution of a program sounds counter-productive to me, honestly. :(
>

Well, go run does not just execute a program. It compiles
the program und executes the compiled binary. The execution
part doesn't need any internet connectivity, but the compilation
step _might_ need one of some dependencies are not available.
This is one of the many problems with go run.

But note that this is the case for each and every language:
You cannot run Java, C#, Rust, FORTRAN, R, whatnot code
if dependencies are missing and not retrievable.

V. 

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/a57fa76c-2636-4958-bce2-3161134e9fc5%40googlegroups.com.