Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go/ir: update for Go 1.17 #1045

Closed
ainar-g opened this issue Jul 1, 2021 · 8 comments
Closed

go/ir: update for Go 1.17 #1045

ainar-g opened this issue Jul 1, 2021 · 8 comments
Labels
bug go1.17 Work to do once/in time for when Go 1.17 releases

Comments

@ainar-g
Copy link
Contributor

ainar-g commented Jul 1, 2021

See also:

Synopsis:

$ go install honnef.co/go/tools/cmd/staticcheck@master

$ staticcheck --debug.version
  staticcheck (devel, v0.3.0-0.dev.0.20210610122209-28f373ac6cb1)

  Compiled with Go version: go1.17beta1
  Main module:
  	honnef.co/go/tools@v0.3.0-0.dev.0.20210610122209-28f373ac6cb1 (sum: h1:dDPeZNwwZtnwRhE06NPArs32iPjZcu1dERBqcymcSwg=)
  Dependencies:
  	github.com/BurntSushi/toml@v0.3.1 (sum: h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=)
  	golang.org/x/mod@v0.4.2 (sum: h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=)
  	golang.org/x/sys@v0.0.0-20210510120138-977fb7262007 (sum: h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE=)
  	golang.org/x/tools@v0.1.3-0.20210529002143-6123e5fbf24b (sum: h1:oRWktbvlCLroCQeAn0bO+yyQy8vmj7Fu+J41xJTt1YM=)
  	golang.org/x/xerrors@v0.0.0-20200804184101-5ec99f83aff1 (sum: h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=)

$ more ./main.go 
  package main

  import (
  	"fmt"
  )

  func main() {
  	fmt.Println(*(*[2]int)([]int{1, 2}))
  }

$ staticcheck ./main.go 
  panic: in command-line-arguments.main: cannot convert Load <[]int> t0 ([]int) to *[2]int

  goroutine 154 [running]:
  honnef.co/go/tools/go/ir.emitConv(0xc000165b00, {0x96ce48, 0xc000293920}, {0x95dd98, 0xc0005b1830}, {0x95d500, 0xc0006083c0})
  	/home/ainar/go/pkg/mod/honnef.co/go/tools@v0.3.0-0.dev.0.20210610122209-28f373ac6cb1/go/ir/emit.go:250 +0x9d4
  honnef.co/go/tools/go/ir.(*builder).expr0(0xc000683b00, 0xc000165b00, {0x95f068, 0xc0006083c0}, {0x7, {0x95dd98, 0xc0005b1830}, {0x0, 0x0}})
  	/home/ainar/go/pkg/mod/honnef.co/go/tools@v0.3.0-0.dev.0.20210610122209-28f373ac6cb1/go/ir/builder.go:544 +0xa77
  […]

I guess the vendored version of golang.org/x/tools needs updating?

@ainar-g ainar-g added bug needs-triage Newly filed issue that needs triage labels Jul 1, 2021
@dominikh dominikh added go1.17 Work to do once/in time for when Go 1.17 releases and removed needs-triage Newly filed issue that needs triage labels Jul 2, 2021
@dominikh
Copy link
Owner

dominikh commented Jul 7, 2021

We have a forked and modified version of go/ssa. We'll have to backport the change.

@dominikh dominikh added the started Issues we've started working on label Jul 7, 2021
@dominikh
Copy link
Owner

dominikh commented Jul 7, 2021

This may also require updating some of our checks. Before this language change, type conversions could not fail at runtime, but now they can.

@dominikh dominikh changed the title panic with Go 1.17 slice-to-array conversions go/ir: update for Go 1.17 Jul 7, 2021
@dominikh
Copy link
Owner

dominikh commented Jul 7, 2021

We should make sure that we support the new functions in unsafe, too, while we're here.

dominikh added a commit that referenced this issue Jul 8, 2021
This is a backport of x/tool's
20dafe5d6055a2382de349face79f568e574d9fd.

Updates gh-1045
dominikh added a commit that referenced this issue Jul 8, 2021
This is a backport of x/tool's
640c1dea83015e5271a001c99370762fc63dc280.

Updates gh-1045
@dominikh
Copy link
Owner

dominikh commented Jul 8, 2021

I think we're done.

@dominikh dominikh closed this as completed Jul 8, 2021
@ainar-g
Copy link
Contributor Author

ainar-g commented Jul 8, 2021

I confirm that the latest master fixes the issue for me.

@ainar-g
Copy link
Contributor Author

ainar-g commented Jul 22, 2021

@dominikh, should the solution be updated considering the discussion in golang/go#46978 and CL 333749?

@dominikh
Copy link
Owner

@ainar-g Yes, I'll backport that change.

dominikh added a commit that referenced this issue Aug 16, 2021
This is a backport of x/tool's
20dafe5d6055a2382de349face79f568e574d9fd.

Updates gh-1045

(cherry picked from commit 3ec1dd2)
dominikh added a commit that referenced this issue Aug 16, 2021
This is a backport of x/tool's
640c1dea83015e5271a001c99370762fc63dc280.

Updates gh-1045

(cherry picked from commit e5c61cf)
@ainar-g
Copy link
Contributor Author

ainar-g commented Sep 9, 2021

@dominikh, another one to consider: golang/go#48281.

cuonglm added a commit to cuonglm/go-tools that referenced this issue Sep 11, 2021
This is a backport of golang.org/cl/333749 and golang.org/cl/348511.

Updates dominikhgh-1045
cuonglm added a commit to cuonglm/go-tools that referenced this issue Sep 12, 2021
This is a backport of golang.org/cl/333749 and golang.org/cl/348511.

Updates dominikhgh-1045
@dominikh dominikh removed the started Issues we've started working on label Oct 17, 2021
dominikh added a commit that referenced this issue Oct 29, 2021
This is a backport of golang.org/cl/333749 and golang.org/cl/348511.

Updates: gh-1045
Closes: gh-1081 [via git-merge-pr]
Co-authored-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
dominikh added a commit that referenced this issue Nov 11, 2021
This is a backport of golang.org/cl/333749 and golang.org/cl/348511.

Updates: gh-1045
Closes: gh-1081 [via git-merge-pr]
Co-authored-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
(cherry picked from commit 61e00c9)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug go1.17 Work to do once/in time for when Go 1.17 releases
Projects
None yet
Development

No branches or pull requests

2 participants