Skip to content

Go version indicator should support Go workspaces: detection of go.workΒ #660

Description

@llawn

Is your feature request related to a problem? Please describe

Currently, the go item extension in Tide only detects if a user is inside a Go project by checking for the existence of a go.mod file. However, Go has natively supported multi-module workspaces via go.work files since Go 1.18.

If a developer opens a shell in the root of a Go workspace that contains a go.work file but no top-level go.mod file, Tide fails to display the Go prompt item and version indicator.

Describe the solution you'd like

The go prompt item should become visible if either a go.mod or a go.work file is present in the current directory or any parent directories.

  • Current Implementation (functions/_tide_item_go.fish):

    function _tide_item_go
        if path is $_tide_parent_dirs/go.mod
            go version | string match -qr "(?<v>[\d.]+)"
            _tide_print_item go $tide_go_icon' ' $v
        end
    end
  • Proposed solution:

    function _tide_item_go
        if path is $_tide_parent_dirs/go.mod $_tide_parent_dirs/go.work
            go version | string match -qr "(?<v>[\d.]+)"
            _tide_print_item go $tide_go_icon' ' $v
        end
    end

Steps to Reproduce

  1. Create a new directory and initialize a go workspace: mkdir go-workspace && cd go-workspace && go work init
  2. The Tide prompt does not display the Go version indicator.

Environment

fish version: 4.7.1
tide version: 6.2.0
term: xterm-kitty
os: Arch Linux x86_64
terminal emulator: kitty 0.46.2
fish startup: 12.08 millis
fisher plugins: ilancosman/tide@v6

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions