Re: [go-nuts] Language spec question: why is k, v := k, v allowed in a for loop with range?

2020-01-12 Thread Silvan Jegen
Jan Mercl <0xj...@gmail.com> wrote: > On Sun, Jan 12, 2020 at 10:10 AM Silvan Jegen wrote: > > > So the declaration of the variables in the for loop itself is in outer > > scope compared to the body of the for loop? > > The outer scope begins immediately after the

Re: [go-nuts] Language spec question: why is k, v := k, v allowed in a for loop with range?

2020-01-12 Thread Silvan Jegen
for loop? In that case, redeclaring them in the inner scope (== the loop body) would not be allowed either, no? It also wouldn't explain the k := k case since ':=' has to redeclare at least one new variable according to the spec. Cheers, Silvan > On Sun, 2020-01-12 at 09:0

[go-nuts] Language spec question: why is k, v := k, v allowed in a for loop with range?

2020-01-12 Thread Silvan Jegen
Hi fellow gophers The following code compiles package main import ( "fmt" ) func main() { mymap := map[string]int{"a": 1, "b": 2} for k, v := range mymap { k, v := k, v fmt.Printf("k %s, v: %d\n", k, v) } } while this one doesn'

[go-nuts] Re: Golang binary on Mac OS error “operation not permitted”

2017-12-06 Thread Silvan Jegen
On Wednesday, December 6, 2017 at 4:52:11 AM UTC+1, Srinivas Gowda wrote: > > I'm trying to ship a golang binary inside a mac app. It is ideally just a > http server with some basic functions on folders and files. > > The binary seems to work just fine when I run it from a terminal but when > I