Re: [go-nuts] Re: go1.17rc2 fails to compile slice-to-array-pointer conversions if go.mod doesn't specify go directive

2021-08-11 Thread Ian Lance Taylor
On Wed, Aug 11, 2021 at 6:51 PM Cuong Manh Le  wrote:
>
> > go run -gcflags="-lang=go1.17" main.go
> >
> > doesn't work either.
>
> Because what was run:
>
> ```
> /Users/cuonglm/sdk/gotip/pkg/tool/darwin_arm64/compile -o $WORK/b001/_pkg_.a 
> -trimpath "$WORK/b001=>" -shared -lang=go1.17 -p main -lang=go1.16 -complete 
> -buildid iarBRwadYSTC65zcr7pK/iarBRwadYSTC65zcr7pK -dwarf=false -D 
> _/Users/cuonglm/t -importcfg $WORK/b001/importcfg -pack ./main.go 
> $WORK/b001/_gomod_.go
> ```
>
> Notice "-lang" is passed two times, and the later "-lang=go1.16" wins.

Passing the default -lang option after the -gcflags seems like a bug, though.

Ian

-- 
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/CAOyqgcWz8SEYRfWXUhM13XQtUnx39qQ_QzsKWFNyZpkdrWkKeg%40mail.gmail.com.


Re: [go-nuts] Re: go1.17rc2 fails to compile slice-to-array-pointer conversions if go.mod doesn't specify go directive

2021-08-11 Thread tapi...@gmail.com
So, it is a bug? Or not? I'm some confused.

On Wednesday, August 11, 2021 at 9:51:55 PM UTC-4 cuong.m...@gmail.com 
wrote:

> > go run -gcflags="-lang=go1.17" main.go
> >
> > doesn't work either.
>
> Because what was run:
>
> ```
> /Users/cuonglm/sdk/gotip/pkg/tool/darwin_arm64/compile -o 
> $WORK/b001/_pkg_.a -trimpath "$WORK/b001=>" -shared -lang=go1.17 -p main 
> -lang=go1.16 -complete -buildid iarBRwadYSTC65zcr7pK/iarBRwadYSTC65zcr7pK 
> -dwarf=false -D _/Users/cuonglm/t -importcfg $WORK/b001/importcfg -pack 
> ./main.go $WORK/b001/_gomod_.go
> ```
>
> Notice "-lang" is passed two times, and the later "-lang=go1.16" wins.
>
> Cuong Manh Le
> https://cuonglm.xyz
>
>
> On Thu, Aug 12, 2021 at 7:56 AM tapi...@gmail.com  
> wrote:
>
>> BTW, 
>>
>> go run -gcflags="-lang=go1.17" main.go
>>
>> doesn't work either.
>>
>> On Wednesday, August 11, 2021 at 10:45:05 AM UTC-4 tapi...@gmail.com 
>> wrote:
>>
>>> // main.go
>>> package main
>>>
>>> func main() {
>>> var s = []int{1, 2, 3}
>>> var pa = (*[2]int)(s[1:])
>>> println(pa[1])
>>> }
>>>
>>> $ go run main.go 
>>> # command-line-arguments
>>> ./main.go:6:23: cannot convert s[1:] (type []int) to type *[2]int:
>>> conversion of slices to array pointers only supported as of 
>>> -lang=go1.17
>>>
>>> Is it the deliberate design? Shouldn't the lang value be the highest 
>>> language version supported by the current used toolchain?
>>>
>> -- 
>> 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.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/06c2c090-d73d-4642-9b16-493e716222c4n%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/51f7a80c-befe-45b5-9521-f30bc8d7d5f1n%40googlegroups.com.


Re: [go-nuts] Re: go1.17rc2 fails to compile slice-to-array-pointer conversions if go.mod doesn't specify go directive

2021-08-11 Thread Cuong Manh Le
> go run -gcflags="-lang=go1.17" main.go
>
> doesn't work either.

Because what was run:

```
/Users/cuonglm/sdk/gotip/pkg/tool/darwin_arm64/compile -o
$WORK/b001/_pkg_.a -trimpath "$WORK/b001=>" -shared -lang=go1.17 -p main
-lang=go1.16 -complete -buildid iarBRwadYSTC65zcr7pK/iarBRwadYSTC65zcr7pK
-dwarf=false -D _/Users/cuonglm/t -importcfg $WORK/b001/importcfg -pack
./main.go $WORK/b001/_gomod_.go
```

Notice "-lang" is passed two times, and the later "-lang=go1.16" wins.

Cuong Manh Le
https://cuonglm.xyz


On Thu, Aug 12, 2021 at 7:56 AM tapi...@gmail.com 
wrote:

> BTW,
>
> go run -gcflags="-lang=go1.17" main.go
>
> doesn't work either.
>
> On Wednesday, August 11, 2021 at 10:45:05 AM UTC-4 tapi...@gmail.com
> wrote:
>
>> // main.go
>> package main
>>
>> func main() {
>> var s = []int{1, 2, 3}
>> var pa = (*[2]int)(s[1:])
>> println(pa[1])
>> }
>>
>> $ go run main.go
>> # command-line-arguments
>> ./main.go:6:23: cannot convert s[1:] (type []int) to type *[2]int:
>> conversion of slices to array pointers only supported as of
>> -lang=go1.17
>>
>> Is it the deliberate design? Shouldn't the lang value be the highest
>> language version supported by the current used toolchain?
>>
> --
> 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/06c2c090-d73d-4642-9b16-493e716222c4n%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/CALS7p_dgwuZ%3DNcjf0HcX0SiFt_%2BwMAW3aUsN%3D6r2XYpzRqGDow%40mail.gmail.com.


[go-nuts] Re: go1.17rc2 fails to compile slice-to-array-pointer conversions if go.mod doesn't specify go directive

2021-08-11 Thread tapi...@gmail.com
BTW, 

go run -gcflags="-lang=go1.17" main.go

doesn't work either.

On Wednesday, August 11, 2021 at 10:45:05 AM UTC-4 tapi...@gmail.com wrote:

> // main.go
> package main
>
> func main() {
> var s = []int{1, 2, 3}
> var pa = (*[2]int)(s[1:])
> println(pa[1])
> }
>
> $ go run main.go 
> # command-line-arguments
> ./main.go:6:23: cannot convert s[1:] (type []int) to type *[2]int:
> conversion of slices to array pointers only supported as of 
> -lang=go1.17
>
> Is it the deliberate design? Shouldn't the lang value be the highest 
> language version supported by the current used toolchain?
>

-- 
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/06c2c090-d73d-4642-9b16-493e716222c4n%40googlegroups.com.