Skip to content

<unknown line number>: internal compiler error: assertion failed #8700

Description

@ddkwork

Describe the bug

A clear and concise description of what the bug is. Include version by typing gh --version.
gh version 2.43.1 (2024-01-31)
https://github.com/cli/cli/releases/tag/v2.43.1

Steps to reproduce the behavior

  1. Type this 'C:\Users\Admin\Desktop\cli-trunk\cmd\gh\main.go'
  2. View the output 'see log'
  3. See error : internal compiler error: assertion failed

Expected vs actual behavior

A clear and concise description of what you expected to happen and what actually happened.

Logs

GOROOT=C:\Users\Admin\go\pkg\mod\golang.org\[email protected] #gosetup
GOPATH=C:\Users\Admin\go #gosetup
C:\Users\Admin\go\pkg\mod\golang.org\[email protected]\bin\go.exe build -o C:\Users\Admin\AppData\Local\JetBrains\GoLand2023.3\tmp\GoLand___go_build_github_com_cli_cli_v2_cmd_gh.exe github.com/cli/cli/v2/cmd/gh #gosetup

github.com/cli/cli/v2/pkg/cmd/repo/garden

CLOSURE [C:\Users\Admin\Desktop\cli-trunk\pkg\cmd\repo\garden\garden.go:241:11:var player *github.com/cli/cli/v2/pkg/cmd/repo/garden.Player ....\pkg\cmd\repo\garden\garden.go:244:10:var dirc chan int ....\pkg\cmd\repo\garden\garden.go:251:18:var garden [][]*github.com/cli/cli/v2/pkg/cmd/repo/garden.Cell ....\pkg\cmd\repo\garden\garden.go:301:40:var oldTermState *golang.org/x/term.State]
: internal compiler error: assertion failed

Please file a bug report including a short program that triggers the error.
https://go.dev/issue/new

编译完成,并显示退出代码 1

Paste the activity from your command line. Redact if needed.

Activity

  1. ddkwork commented on Feb 15, 2024

    @ddkwork
    Author

    go1.21 and 1.22 all build error with gh.

  2. williammartin commented on Feb 15, 2024

    @williammartin
    Member

    Hey @ddkwork, I don't understand what you're trying to do here:

    C:\Users\Admin\Desktop\cli-trunk\cmd\gh\main.go
    

    Admittedly I don't use Windows but this seems like you are trying to execute the main.go file directly without go run or compiling it with go build?

    What are you actually trying to achieve here?

    It does look like you've landed on some kind of internal go compiler error which is interesting. Can you say more about the environment you're building on? We build for windows in CI successfully.

  3. added
    more-info-neededMore info needed from user/contributor
    and removed on Feb 15, 2024
  4. ddkwork commented on Feb 15, 2024

    @ddkwork
    Author

    Hey @ddkwork, I don't understand what you're trying to do here:

    C:\Users\Admin\Desktop\cli-trunk\cmd\gh\main.go
    

    Admittedly I don't use Windows but this seems like you are trying to execute the main.go file directly without go run or compiling it with go build?

    What are you actually trying to achieve here?

    It does look like you've landed on some kind of internal go compiler error which is interesting. Can you say more about the environment you're building on? We build for windows in CI successfully.

    screenshots

  5. ddkwork commented on Feb 15, 2024

    @ddkwork
    Author

    C:\Users\Admin\Desktop>go install github.com/cli/cli/v2/cmd/gh@latest
    go: downloading github.com/cli/cli v1.14.0
    go: downloading github.com/cli/cli/v2 v2.43.1

    github.com/cli/cli/v2/pkg/cmd/repo/garden

    CLOSURE [C:\Users\Admin\go\pkg\mod\github.com\cli\cli\[email protected]\pkg\cmd\repo\garden\garden.go:241:11:var player *github.com/cli/cli/v2/pkg/cmd/repo/garden.Player ..\go\pkg\mod\github.com\cli\cli\[email protected]\pkg\cmd\repo\garden\garden.go:244:10:var dirc chan int ..\go\pkg\mod\github.com\cli\cli\[email protected]\pkg\cmd\repo\garden\garden.go:251:18:var garden [][]*github.com/cli/cli/v2/pkg/cmd/repo/garden.Cell ..\go\pkg\mod\github.com\cli\cli\[email protected]\pkg\cmd\repo\garden\garden.go:301:40:var oldTermState *golang.org/x/term.State]
    : internal compiler error: assertion failed

    Please file a bug report including a short program that triggers the error.
    https://go.dev/issue/new

    C:\Users\Admin\Desktop>

  6. ddkwork commented on Feb 17, 2024

    @ddkwork
    Author

    Hey @ddkwork, I don't understand what you're trying to do here:

    C:\Users\Admin\Desktop\cli-trunk\cmd\gh\main.go
    

    Admittedly I don't use Windows but this seems like you are trying to execute the main.go file directly without go run or compiling it with go build?

    What are you actually trying to achieve here?

    It does look like you've landed on some kind of internal go compiler error which is interesting. Can you say more about the environment you're building on? We build for windows in CI successfully.

    Isn't this bug going to be fixed?
    screenshots

  7. williammartin commented on Feb 17, 2024

    @williammartin
    Member

    @ddkwork, we have an enormous number of community issues and PRs to address. Yes, we will fix bugs. I appreciate your continued debugging.

    This appears to occur when building the CLI with go 1.22, for windows:

    ➜ GOOS=windows go build -o bin/gh ./cmd/gh
    
    # github.com/cli/cli/v2/pkg/cmd/repo/garden
    CLOSURE [/Users/williammartin/workspace/cli/pkg/cmd/repo/garden/garden.go:241:11:var player *github.com/cli/cli/v2/pkg/cmd/repo/garden.Player pkg/cmd/repo/garden/garden.go:244:10:var dirc chan int pkg/cmd/repo/garden/garden.go:251:18:var garden [][]*github.com/cli/cli/v2/pkg/cmd/repo/garden.Cell pkg/cmd/repo/garden/garden.go:301:40:var oldTermState *golang.org/x/term.State]
    <unknown line number>: internal compiler error: assertion failed
    
    Please file a bug report including a short program that triggers the error.
    https://go.dev/issue/new
    

    Since we are currently building our releases with Go 1.21 it's something we will definitely need to address before bumping to Go 1.22. It would be good if we could address it before then but it depends on the amount of work required.

    Note that this is a regression in the Go compiler, not in this CLI. In the meantime if you want to build the CLI on Windows you will need to use Go 1.21.

    This issue created in the Go repo looks quite relevant: golang/go#65593

  8. added
    priority-2Affects more than a few users but doesn't prevent core functions
    coreThis issue is not accepting PRs from outside contributors
    and removed
    more-info-neededMore info needed from user/contributor
    on Feb 17, 2024
  9. ddkwork commented on Feb 17, 2024

    @ddkwork
    Author

    @ddkwork, we have an enormous number of community issues and PRs to address. Yes, we will fix bugs. I appreciate your continued debugging.

    This appears to occur when building the CLI with go 1.22, for windows:

    ➜ GOOS=windows go build -o bin/gh ./cmd/gh
    
    # github.com/cli/cli/v2/pkg/cmd/repo/garden
    CLOSURE [/Users/williammartin/workspace/cli/pkg/cmd/repo/garden/garden.go:241:11:var player *github.com/cli/cli/v2/pkg/cmd/repo/garden.Player pkg/cmd/repo/garden/garden.go:244:10:var dirc chan int pkg/cmd/repo/garden/garden.go:251:18:var garden [][]*github.com/cli/cli/v2/pkg/cmd/repo/garden.Cell pkg/cmd/repo/garden/garden.go:301:40:var oldTermState *golang.org/x/term.State]
    <unknown line number>: internal compiler error: assertion failed
    
    Please file a bug report including a short program that triggers the error.
    https://go.dev/issue/new
    

    Since we are currently building our releases with Go 1.21 it's something we will definitely need to address before bumping to Go 1.22. It would be good if we could address it before then but it depends on the amount of work required.

    Note that this is a regression in the Go compiler, not in this CLI. In the meantime if you want to build the CLI on Windows you will need to use Go 1.21.

    This issue created in the Go repo looks quite relevant: golang/go#65593

    In order to test whether go1.21 has this kind of problem, I downloaded 1.21 yesterday and tested it, and the same result

  10. williammartin commented on Feb 17, 2024

    @williammartin
    Member

    That's interesting because it doesn't reproduce for me:

    ➜  ~ go version
    go version go1.21.7 darwin/arm64
    ➜  ~ GOOS=windows go install github.com/cli/cli/v2/cmd/gh@latest
    ➜  ~ echo $?
    0
    

    And we did a release yesterday using 1.21.7 that was fine:

    https://github.com/cli/cli/actions/runs/7933918727/job/21663758422#step:3:12

    I'll need to find a windows machine somewhere to try and get my environment as close to yours if you are indeed seeing this on go 1.21.7.

  11. 4 remaining items

  12. ddkwork commented on Feb 17, 2024

    @ddkwork
    Author
    Details

    GOROOT=C:\Users\Admin\go\pkg\mod\golang.org\[email protected] #gosetup
    GOPATH=C:\Users\Admin\go #gosetup
    C:\Users\Admin\go\pkg\mod\golang.org\[email protected]\bin\go.exe build -o C:\Users\Admin\AppData\Local\JetBrains\GoLand2023.3\tmp\GoLand___go_build_github_com_cli_cli_v2_cmd_gh.exe github.com/cli/cli/v2/cmd/gh #gosetup
    C:\Users\Admin\AppData\Local\JetBrains\GoLand2023.3\tmp\GoLand___go_build_github_com_cli_cli_v2_cmd_gh.exe
    Work seamlessly with GitHub from the command line.

    USAGE
    gh [flags]

    CORE COMMANDS
    auth: Authenticate gh and git with GitHub
    browse: Open the repository in the browser
    codespace: Connect to and manage codespaces
    gist: Manage gists
    issue: Manage issues
    org: Manage organizations
    pr: Manage pull requests
    project: Work with GitHub Projects.
    release: Manage releases
    GITHUB ACTIONS COMMANDSepositories
    cache: Manage Github Actions caches
    run: View details about workflow runs
    ALIAS COMMANDS View details about GitHub Actions workflows
    co: Alias for "pr checkout"

    ADDITIONAL COMMANDS
    alias: Create command shortcuts
    api: Make an authenticated GitHub API request
    completion: Generate shell completion scripts
    config: Manage configuration for gh
    extension: Manage gh extensions
    gpg-key: Manage GPG keys
    label: Manage labels
    ruleset: View info about repo rulesets
    search: Search for repositories, issues, and pull requests
    secret: Manage GitHub secrets
    ssh-key: Manage SSH keys
    status: Print information about relevant issues, pull requests, and notif
    fications across repositories
    variable: Manage GitHub Actions variables

    HELP TOPICS
    actions: Learn about working with GitHub Actions
    environment: Environment variables that can be used with gh
    exit-codes: Exit codes used by gh
    formatting: Formatting options for JSON data exported from gh
    mintty: Information about using gh with MinTTY
    reference: A comprehensive reference of all gh commands

    FLAGS
    --help Show help for command
    --version Show gh version

    EXAMPLES
    $ gh issue create
    $ gh repo clone cli/cli
    $ gh pr checkout 321

    LEARN MORE
    Use gh <command> <subcommand> --help for more information about a command.
    Read the manual at https://cli.github.com/manual

    进程 已完成,退出代码为 0

  13. ddkwork commented on Feb 17, 2024

    @ddkwork
    Author

    image

  14. ddkwork commented on Feb 17, 2024

    @ddkwork
    Author

    Isn't it good to add a function? It has to break to disrupt the logic

  15. williammartin commented on Feb 17, 2024

    @williammartin
    Member

    Sorry, I misunderstood you. I thought you were "sure that the build was broken on 1.21". I see now that you were "sure that removing the gh repo garden command fixes the build".

    Alright. I will talk with the team about the best choice after the weekend.

    Thank you for you patience.

  16. williammartin commented on Feb 17, 2024

    @williammartin
    Member

    Isn't it good to add a function? It has to break to disrupt the logic

    It could be, but I wonder if we could do this: 81be2b6

    Reading the code I don't see any reason why we need to break or continue to mainLoop. The mainLoop label applies to the outermost for loop, and there's no more deeply nested break mainLoop or continue mainLoop statements.

    The compiler bug appears to be related to labels.

    What do you think?

  17. ddkwork commented on Feb 17, 2024

    @ddkwork
    Author
  18. ddkwork commented on Feb 17, 2024

    @ddkwork
    Author
  19. ddkwork commented on Feb 17, 2024

    @ddkwork
    Author

    please merge 81be2b6 into thunk,i was build successful it.

  20. andyfeller commented on Feb 18, 2024

    @andyfeller
    Contributor

    @williammartin : building this in Windows 10 in PowerShell Desktop 5.1 works (make installed via choco) and runs, so I think @ddkwork is just having an issue with this on Go 1.22. Additionally noting that #8668 raised a different concern with the move to Go 1.22.

    PS C:\Users\andre\Documents\cli\cli> $PSVersionTable
    
    Name                           Value
    ----                           -----
    PSVersion                      5.1.19041.4046
    PSEdition                      Desktop
    PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
    BuildVersion                   10.0.19041.4046
    CLRVersion                     4.0.30319.42000
    WSManStackVersion              3.0
    PSRemotingProtocolVersion      2.3
    SerializationVersion           1.1.0.1
    
    PS C:\Users\andre\Documents\cli\cli> make
    go build -trimpath -ldflags "-X github.com/cli/cli/v2/internal/build.Date=2024-02-18 -X github.com/cli/cli/v2/internal/build.Version=v2.44.1 " -o bin/gh.exe ./cmd/gh
    go: downloading github.com/AlecAivazis/survey/v2 v2.3.7
    go: downloading github.com/mattn/go-isatty v0.0.20
    go: downloading github.com/spf13/cobra v1.6.1
    go: downloading github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d
    go: downloading golang.org/x/term v0.15.0
    go: downloading github.com/hashicorp/go-version v1.3.0
    go: downloading gopkg.in/yaml.v3 v3.0.1
    go: downloading github.com/cli/go-gh/v2 v2.5.0
    go: downloading github.com/briandowns/spinner v1.18.1
    go: downloading github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
    go: downloading github.com/mattn/go-colorable v0.1.13
    go: downloading github.com/MakeNowJust/heredoc v1.0.0
    go: downloading github.com/spf13/pflag v1.0.5
    go: downloading github.com/zalando/go-keyring v0.2.3
    go: downloading github.com/stretchr/testify v1.8.4
    go: downloading github.com/shurcooL/githubv4 v0.0.0-20230704064427-599ae7bbf278
    go: downloading golang.org/x/sync v0.1.0
    go: downloading golang.org/x/text v0.14.0
    go: downloading golang.org/x/sys v0.15.0
    go: downloading github.com/fatih/color v1.7.0
    go: downloading github.com/charmbracelet/glamour v0.6.0
    go: downloading github.com/charmbracelet/lipgloss v0.5.0
    go: downloading github.com/inconshreveable/mousetrap v1.0.1
    go: downloading github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
    go: downloading github.com/cli/shurcooL-graphql v0.0.4
    go: downloading github.com/cli/browser v1.3.0
    go: downloading github.com/henvic/httpretty v0.1.3
    go: downloading github.com/thlib/go-timezone-local v0.0.0-20210907160436-ef149e42d28e
    go: downloading github.com/itchyny/gojq v0.12.13
    go: downloading github.com/muesli/termenv v0.13.0
    go: downloading github.com/muesli/reflow v0.3.0
    go: downloading github.com/gdamore/tcell/v2 v2.5.4
    go: downloading github.com/rivo/tview v0.0.0-20221029100920-c4a7e501810d
    go: downloading github.com/danieljoos/wincred v1.2.0
    go: downloading github.com/microsoft/dev-tunnels v0.0.25
    go: downloading github.com/muhammadmuzzammil1998/jsonc v0.0.0-20201229145248-615b0916ca38
    go: downloading github.com/cenkalti/backoff/v4 v4.2.1
    go: downloading github.com/shurcooL/graphql v0.0.0-20230722043721-ed46e5a46466
    go: downloading github.com/davecgh/go-spew v1.1.1
    go: downloading github.com/pmezard/go-difflib v1.0.0
    go: downloading github.com/stretchr/objx v0.5.0
    go: downloading github.com/hashicorp/go-multierror v1.1.1
    go: downloading github.com/joho/godotenv v1.5.1
    go: downloading golang.org/x/crypto v0.17.0
    go: downloading github.com/lucasb-eyer/go-colorful v1.2.0
    go: downloading github.com/mattn/go-runewidth v0.0.14
    go: downloading github.com/aymanbagabas/go-osc52 v1.0.3
    go: downloading github.com/cli/oauth v1.0.1
    go: downloading github.com/opentracing/opentracing-go v1.1.0
    go: downloading google.golang.org/grpc v1.56.3
    go: downloading github.com/gabriel-vasile/mimetype v1.4.3
    go: downloading github.com/yuin/goldmark v1.5.2
    go: downloading github.com/yuin/goldmark-emoji v1.0.1
    go: downloading github.com/itchyny/timefmt-go v0.1.5
    go: downloading github.com/hashicorp/errwrap v1.0.0
    go: downloading github.com/rivo/uniseg v0.4.4
    go: downloading github.com/gorilla/websocket v1.4.2
    go: downloading google.golang.org/protobuf v1.30.0
    go: downloading github.com/alecthomas/chroma v0.10.0
    go: downloading github.com/microcosm-cc/bluemonday v1.0.26
    go: downloading github.com/olekukonko/tablewriter v0.0.5
    go: downloading github.com/gdamore/encoding v1.0.0
    go: downloading github.com/rodaine/table v1.0.1
    go: downloading golang.org/x/net v0.17.0
    go: downloading github.com/aymerick/douceur v0.2.0
    go: downloading github.com/gorilla/css v1.0.0
    go: downloading github.com/dlclark/regexp2 v1.4.0
    go: downloading google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1
    go: downloading github.com/golang/protobuf v1.5.3
    
    PS C:\Users\andre\Documents\cli\cli> .\bin\gh.exe version
    gh version 2.44.1 (2024-02-18)
    https://github.com/cli/cli/releases/tag/v2.44.1
    
    PS C:\Users\andre\Documents\cli\cli> go version
    go version go1.21.7 windows/amd64
    
    PS C:\Users\andre\Documents\cli\cli> .\bin\gh.exe repo garden
    sorry :( this command only works on linux and macos
  21. ddkwork commented on Feb 18, 2024

    @ddkwork
    Author

    Windows is not supported in the first place, it is normal

  22. greyaxie commented on Mar 14, 2024

    @greyaxie
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcoreThis issue is not accepting PRs from outside contributorspriority-2Affects more than a few users but doesn't prevent core functions

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions