Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

Commit

Permalink
Add build tags to make the project compatible with gopls
Browse files Browse the repository at this point in the history
The gopls deamon for text editor integrations used to complain about the `main()` function being redeclared across multiple `package main` files that share the same directory. This is because these individual scripts were meant to be run with `go run path/to/file.go` instead of being built as a binary. The latest gopls release supports recognizing files that are meant as individual runnable scripts, but they must be tagged with a build tag that makes them otherwise ignored.
  • Loading branch information
mislav committed Nov 23, 2022
1 parent b54ce38 commit 3dcc04a
Show file tree
Hide file tree
Showing 22 changed files with 49 additions and 5 deletions.
2 changes: 2 additions & 0 deletions examples/countrylist.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build ignore

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/cursor.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build ignore

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/inputfilesuggestion.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build ignore

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/longlist.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build ignore

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/longmulti.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build ignore

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/longmultikeepfilter.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build ignore

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/map.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build ignore

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/password.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build ignore

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/select_description.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build ignore

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/simple.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build ignore

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/validation.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build ignore

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions tests/ask.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build ignore

package main

import (
Expand Down
4 changes: 3 additions & 1 deletion tests/confirm.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
//go:build ignore

package main

import (
"github.com/AlecAivazis/survey/v2"
"github.com/AlecAivazis/survey/v2/tests/util"
TestUtil "github.com/AlecAivazis/survey/v2/tests/util"
)

var answer = false
Expand Down
2 changes: 2 additions & 0 deletions tests/doubleSelect.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build ignore

package main

import (
Expand Down
4 changes: 3 additions & 1 deletion tests/editor.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
//go:build ignore

package main

import (
"fmt"
"strings"

"github.com/AlecAivazis/survey/v2"
"github.com/AlecAivazis/survey/v2/tests/util"
TestUtil "github.com/AlecAivazis/survey/v2/tests/util"
)

var answer = ""
Expand Down
4 changes: 3 additions & 1 deletion tests/help.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
//go:build ignore

package main

import (
"github.com/AlecAivazis/survey/v2"
"github.com/AlecAivazis/survey/v2/tests/util"
TestUtil "github.com/AlecAivazis/survey/v2/tests/util"
)

var (
Expand Down
2 changes: 2 additions & 0 deletions tests/input.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build ignore

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions tests/longSelect.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build ignore

package main

import "github.com/AlecAivazis/survey/v2"
Expand Down
2 changes: 2 additions & 0 deletions tests/multiselect.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build ignore

package main

import (
Expand Down
4 changes: 3 additions & 1 deletion tests/password.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
//go:build ignore

package main

import (
"github.com/AlecAivazis/survey/v2"
"github.com/AlecAivazis/survey/v2/tests/util"
TestUtil "github.com/AlecAivazis/survey/v2/tests/util"
)

var value = ""
Expand Down
4 changes: 3 additions & 1 deletion tests/select.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
//go:build ignore

package main

import (
"github.com/AlecAivazis/survey/v2"
"github.com/AlecAivazis/survey/v2/tests/util"
TestUtil "github.com/AlecAivazis/survey/v2/tests/util"
)

var answer = ""
Expand Down
2 changes: 2 additions & 0 deletions tests/selectThenInput.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build ignore

package main

import (
Expand Down

0 comments on commit 3dcc04a

Please sign in to comment.