Repository: zeromicro/go-zero (go)

Issue:
Install goctl and got  `package io/fs is not in GOROOT` error
**Describe the bug**
install goctl, use 

```
go get -u github.com/zeromicro/go-zero/tools/goctl@latest
```
then got the error like that:

```
go: github.com/zeromicro/go-zero/tools/goctl latest => v1.3.2
go: gopkg.in/yaml.v2 upgrade => v2.4.0
go: github.com/emicklei/proto upgrade => v1.9.2
go: github.com/go-sql-driver/mysql upgrade => v1.6.0
go: github.com/cpuguy83/go-md2man/v2 upgrade => v2.0.1
go: github.com/lib/pq upgrade => v1.10.4
go: go.opentelemetry.io/otel upgrade => v1.4.1
go: go.opentelemetry.io/otel/trace upgrade => v1.4.1
go: github.com/spaolacci/murmur3 upgrade => v1.1.0
go: github.com/antlr/antlr4/runtime/Go/antlr upgrade => v0.0.0-20220209173558-ad29539cd2e9
go: github.com/russross/blackfriday/v2 upgrade => v2.1.0
*\gopath\pkg\mod\github.com\zeromicro\go-zero\tools\goctl@v1.3.2\migrate\migrate.go:10:2: package io/fs is not in GOROOT (***)
```

golang version :
```
go version go1.15.15 windows/amd64
```


Pull request:
update goctl to go 1.16 for io/fs usage
fix #1564 

Patch:
diff --git a/tools/goctl/api/parser/g4/ast/api.go b/tools/goctl/api/parser/g4/ast/api.go
index d657b9f4..cc747eaf 100644
--- a/tools/goctl/api/parser/g4/ast/api.go
+++ b/tools/goctl/api/parser/g4/ast/api.go
@@ -8,8 +8,10 @@ import (
 	"github.com/zeromicro/go-zero/tools/goctl/api/parser/g4/gen/api"
 )
 
-const prefixKey = "prefix"
-const groupKey = "group"
+const (
+	prefixKey = "prefix"
+	groupKey  = "group"
+)
 
 // Api describes syntax for api
 type Api struct {
diff --git a/tools/goctl/api/parser/g4/gen/api/apiparser_parser.go b/tools/goctl/api/parser/g4/gen/api/apiparser_parser.go
index 82cd78d2..8599337c 100755
--- a/tools/goctl/api/parser/g4/gen/api/apiparser_parser.go
+++ b/tools/goctl/api/parser/g4/gen/api/apiparser_parser.go
@@ -634,4 +634,3 @@ func NewSyntaxLitContext(parser antlr.Parser, parent antlr.ParserRuleContext, in
 
 	return p
 }
-
diff --git a/tools/goctl/completion/const.go b/tools/goctl/completion/const.go
index 2dd95714..4cf81bc0 100644
--- a/tools/goctl/completion/const.go
+++ b/tools/goctl/completion/const.go
@@ -1,7 +1,9 @@
 package completion
 
-const BashCompletionFlag = `generate-goctl-completion`
-const defaultCompletionFilename = "goctl_autocomplete"
+const (
+	BashCompletionFlag        = `generate-goctl-completion`
+	defaultCompletionFilename = "goctl_autocomplete"
+)
 const (
 	magic = 1 << iota
 	flagZsh
diff --git a/tools/goctl/env/check.go b/tools/goctl/env/check.go
index 723e9b96..c6e21d76 100644
--- a/tools/goctl/env/check.go
+++ b/tools/goctl/env/check.go
@@ -44,7 +44,7 @@ func Check(ctx *cli.Context) error {
 }
 
 func check(install, force bool) error {
-	var pending = true
+	pending := true
 	console.Info("[goctl-env]: preparing to check env")
 	defer func() {
 		if p := recover(); p != nil {
diff --git a/tools/goctl/go.mod b/tools/goctl/go.mod
index f43d8f30..bd61025f 100644
--- a/tools/goctl/go.mod
+++ b/tools/goctl/go.mod
@@ -1,6 +1,6 @@
 module github.com/zeromicro/go-zero/tools/goctl
 
-go 1.15
+go 1.16
 
 require (
 	github.com/DATA-DOG/go-sqlmock v1.5.0
diff --git a/tools/goctl/migrate/proxy.go b/tools/goctl/migrate/proxy.go
index b5218940..610f2bab 100644
--- a/tools/goctl/migrate/proxy.go
+++ b/tools/goctl/migrate/proxy.go
@@ -9,8 +9,10 @@ import (
 	"github.com/zeromicro/go-zero/tools/goctl/rpc/execx"
 )
 
-var defaultProxy = "https://goproxy.cn"
-var defaultProxies = []string{defaultProxy}
+var (
+	defaultProxy   = "https://goproxy.cn"
+	defaultProxies = []string{defaultProxy}
+)
 
 func goProxy() []string {
 	wd, err := os.Getwd()
diff --git a/tools/goctl/model/sql/model/informationschemamodel.go b/tools/goctl/model/sql/model/infoschemamodel.go
similarity index 100%
rename from tools/goctl/model/sql/model/informationschemamodel.go
rename to tools/goctl/model/sql/model/infoschemamodel.go
diff --git a/tools/goctl/model/sql/model/postgresqlmodel.go b/tools/goctl/model/sql/model/postgresqlmodel.go
index 16d8813f..95b0c7cf 100644
--- a/tools/goctl/model/sql/model/postgresqlmodel.go
+++ b/tools/goctl/model/sql/model/postgresqlmodel.go
@@ -108,6 +108,7 @@ func (m *PostgreSqlModel) getColumns(schema, table string, in []*PostgreColumn)
 	if err != nil {
 		return nil, err
 	}
+
 	var list []*Column
 	for _, e := range in {
 		var dft interface{}
@@ -120,7 +121,7 @@ func (m *PostgreSqlModel) getColumns(schema, table string, in []*PostgreColumn)
 			isNullAble = "NO"
 		}
 
-		extra := ""
+		var extra string
 		// when identity is true, the column is auto increment
 		if e.IdentityIncrement.Int32 == 1 {
 			extra = "auto_increment"
@@ -178,6 +179,7 @@ func (m *PostgreSqlModel) getIndex(schema, table string) (map[string][]*DbIndex,
 	if err != nil {
 		return nil, err
 	}
+
 	index := make(map[string][]*DbIndex)
 	for _, e := range indexes {
 		if e.IsPrimary.Bool {
@@ -199,6 +201,7 @@ func (m *PostgreSqlModel) getIndex(schema, table string) (map[string][]*DbIndex,
 			SeqInIndex: int(e.IndexSort.Int32),
 		})
 	}
+
 	return index, nil
 }
 
diff --git a/tools/goctl/pkg/collection/sortedmap.go b/tools/goctl/pkg/collection/sortedmap.go
index 90ed2ab1..456170a5 100644
--- a/tools/goctl/pkg/collection/sortedmap.go
+++ b/tools/goctl/pkg/collection/sortedmap.go
@@ -9,8 +9,10 @@ import (
 	"github.com/zeromicro/go-zero/tools/goctl/util/stringx"
 )
 
-var ErrInvalidKVExpression = errors.New(`invalid key-value expression`)
-var ErrInvalidKVS = errors.New("the length of kv must be a even number")
+var (
+	ErrInvalidKVExpression = errors.New(`invalid key-value expression`)
+	ErrInvalidKVS          = errors.New("the length of kv must be a even number")
+)
 
 type KV []interface{}
 
@@ -193,7 +195,7 @@ func (m *SortedMap) Copy() *SortedMap {
 }
 
 func (m *SortedMap) Format() []string {
-	var format = make([]string, 0)
+	format := make([]string, 0)
 	m.Range(func(key, value interface{}) {
 		format = append(format, fmt.Sprintf("%s=%s", key, value))
 	})
diff --git a/tools/goctl/pkg/env/env.go b/tools/goctl/pkg/env/env.go
index 32dea269..0e97e9e6 100644
--- a/tools/goctl/pkg/env/env.go
+++ b/tools/goctl/pkg/env/env.go
@@ -143,5 +143,5 @@ func WriteEnv(kv []string) error {
 		return err
 	}
 	envFile := filepath.Join(defaultGoctlHome, envFileDir)
-	return ioutil.WriteFile(envFile, []byte(strings.Join(goctlEnv.Format(), "\n")), 0777)
+	return ioutil.WriteFile(envFile, []byte(strings.Join(goctlEnv.Format(), "\n")), 0o777)
 }
diff --git a/tools/goctl/rpc/cli/zrpc.go b/tools/goctl/rpc/cli/zrpc.go
index 37b6e3de..f48bd87e 100644
--- a/tools/goctl/rpc/cli/zrpc.go
+++ b/tools/goctl/rpc/cli/zrpc.go
@@ -80,7 +80,7 @@ func ZRPC(c *cli.Context) error {
 		return err
 	}
 
-	var isGooglePlugin = len(grpcOut) > 0
+	isGooglePlugin := len(grpcOut) > 0
 	// If grpcOut is not empty means that user generates grpc code by
 	// https://google.golang.org/protobuf/cmd/protoc-gen-go and
 	// https://google.golang.org/grpc/cmd/protoc-gen-go-grpc,


Test patch:
diff --git a/core/mapping/yamlunmarshaler_test.go b/core/mapping/yamlunmarshaler_test.go
index a44c6c36..3a4d5066 100644
--- a/core/mapping/yamlunmarshaler_test.go
+++ b/core/mapping/yamlunmarshaler_test.go
@@ -937,7 +937,6 @@ func TestUnmarshalYamlReaderError(t *testing.T) {
 	reader = strings.NewReader("chenquan")
 	err = UnmarshalYamlReader(reader, &v)
 	assert.ErrorIs(t, err, ErrUnsupportedType)
-
 }
 
 func TestUnmarshalYamlBadReader(t *testing.T) {
diff --git a/tools/goctl/rpc/cli/zrpc_test.go b/tools/goctl/rpc/cli/zrpc_test.go
index e809f841..54ce6ff5 100644
--- a/tools/goctl/rpc/cli/zrpc_test.go
+++ b/tools/goctl/rpc/cli/zrpc_test.go
@@ -23,7 +23,7 @@ func Test_GetSourceProto(t *testing.T) {
 		return
 	}
 
-	var testData = []test{
+	testData := []test{
 		{
 			source:   []string{"a.proto"},
 			expected: filepath.Join(pwd, "a.proto"),
@@ -54,7 +54,7 @@ func Test_GetSourceProto(t *testing.T) {
 }
 
 func Test_RemoveGoctlFlag(t *testing.T) {
-	var testData = []test{
+	testData := []test{
 		{
 			source:   strings.Fields("protoc foo.proto --go_out=. --go_opt=bar --zrpc_out=. --style go-zero --home=foo"),
 			expected: "protoc foo.proto --go_out=. --go_opt=bar",
@@ -87,7 +87,7 @@ func Test_RemoveGoctlFlag(t *testing.T) {
 }
 
 func Test_RemovePluginFlag(t *testing.T) {
-	var testData = []test{
+	testData := []test{
 		{
 			source:   strings.Fields("plugins=grpc:."),
 			expected: ".",