gotools/gopls/internal/test/marker/testdata/codeaction/imports.txt

This test verifies the behavior of the 'source.organizeImports' code action.

-- go.mod --
module mod.test/imports

go 1.18

-- add.go --
package imports //@codeaction("imports", "", "source.organizeImports", add)

import (
	"fmt"
)

func _() {
	fmt.Println("")
	bytes.NewBuffer(nil) //@diag("bytes", re"(undeclared|undefined)")
}

-- @add/add.go --
package imports //@codeaction("imports", "", "source.organizeImports", add)

import (
	"bytes"
	"fmt"
)

func _() {
	fmt.Println("")
	bytes.NewBuffer(nil) //@diag("bytes", re"(undeclared|undefined)")
}

-- good.go --
package imports //@codeactionerr("imports", "", "source.organizeImports", re"found 0 CodeActions")

import "fmt"

func _() {
fmt.Println("")
}

-- issue35458.go --





// package doc
package imports //@codeaction("imports", "", "source.organizeImports", issue35458)






func _() {
	println("Hello, world!")
}








-- @issue35458/issue35458.go --
// package doc
package imports //@codeaction("imports", "", "source.organizeImports", issue35458)






func _() {
	println("Hello, world!")
}








-- multi.go --
package imports //@codeaction("imports", "", "source.organizeImports", multi)

import "fmt"

import "bytes" //@diag("\"bytes\"", re"not used")

func _() {
	fmt.Println("")
}

-- @multi/multi.go --
package imports //@codeaction("imports", "", "source.organizeImports", multi)

import "fmt"

//@diag("\"bytes\"", re"not used")

func _() {
	fmt.Println("")
}

-- needs.go --
package imports //@codeaction("package", "", "source.organizeImports", needs)

func goodbye() {
	fmt.Printf("HI") //@diag("fmt", re"(undeclared|undefined)")
	log.Printf("byeeeee") //@diag("log", re"(undeclared|undefined)")
}

-- @needs/needs.go --
package imports //@codeaction("package", "", "source.organizeImports", needs)

import (
	"fmt"
	"log"
)

func goodbye() {
	fmt.Printf("HI") //@diag("fmt", re"(undeclared|undefined)")
	log.Printf("byeeeee") //@diag("log", re"(undeclared|undefined)")
}

-- remove.go --
package imports //@codeaction("package", "", "source.organizeImports", remove)

import (
	"bytes" //@diag("\"bytes\"", re"not used")
	"fmt"
)

func _() {
	fmt.Println("")
}

-- @remove/remove.go --
package imports //@codeaction("package", "", "source.organizeImports", remove)

import (
	"fmt"
)

func _() {
	fmt.Println("")
}

-- removeall.go --
package imports //@codeaction("package", "", "source.organizeImports", removeall)

import (
	"bytes" //@diag("\"bytes\"", re"not used")
	"fmt" //@diag("\"fmt\"", re"not used")

)

func _() {
}

-- @removeall/removeall.go --
package imports //@codeaction("package", "", "source.organizeImports", removeall)

//@diag("\"fmt\"", re"not used")

func _() {
}

-- twolines.go --
package imports
func main()  {} //@codeactionerr("main", "", "source.organizeImports", re"found 0")