$88 GRAYBYTE WORDPRESS FILE MANAGER $85

SERVER : vnpttt-amd7f72-h1.vietnix.vn #1 SMP Fri May 24 12:42:50 UTC 2024
SERVER IP : 103.200.23.149 | ADMIN IP 216.73.216.22
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/usr/lib/golang/src/cmd/fix/

HOME
Current File : /usr/lib/golang/src/cmd/fix//gotypes.go
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import (
	"go/ast"
	"strconv"
)

func init() {
	register(gotypesFix)
}

var gotypesFix = fix{
	name: "gotypes",
	date: "2015-07-16",
	f:    gotypes,
	desc: `Change imports of golang.org/x/tools/go/{exact,types} to go/{constant,types}`,
}

func gotypes(f *ast.File) bool {
	fixed := fixGoTypes(f)
	if fixGoExact(f) {
		fixed = true
	}
	return fixed
}

func fixGoTypes(f *ast.File) bool {
	return rewriteImport(f, "golang.org/x/tools/go/types", "go/types")
}

func fixGoExact(f *ast.File) bool {
	// This one is harder because the import name changes.
	// First find the import spec.
	var importSpec *ast.ImportSpec
	walk(f, func(n any) {
		if importSpec != nil {
			return
		}
		spec, ok := n.(*ast.ImportSpec)
		if !ok {
			return
		}
		path, err := strconv.Unquote(spec.Path.Value)
		if err != nil {
			return
		}
		if path == "golang.org/x/tools/go/exact" {
			importSpec = spec
		}

	})
	if importSpec == nil {
		return false
	}

	// We are about to rename exact.* to constant.*, but constant is a common
	// name. See if it will conflict. This is a hack but it is effective.
	exists := renameTop(f, "constant", "constant")
	suffix := ""
	if exists {
		suffix = "_"
	}
	// Now we need to rename all the uses of the import. RewriteImport
	// affects renameTop, but not vice versa, so do them in this order.
	renameTop(f, "exact", "constant"+suffix)
	rewriteImport(f, "golang.org/x/tools/go/exact", "go/constant")
	// renameTop will also rewrite the imported package name. Fix that;
	// we know it should be missing.
	importSpec.Name = nil
	return true
}

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
16 Dec 2025 9.30 PM
root / root
0755
buildtag.go
1.214 KB
4 Dec 2025 6.06 PM
root / root
0644
cftype.go
3.455 KB
4 Dec 2025 6.06 PM
root / root
0644
context.go
0.498 KB
4 Dec 2025 6.06 PM
root / root
0644
doc.go
1.393 KB
4 Dec 2025 6.06 PM
root / root
0644
egltype.go
1.141 KB
4 Dec 2025 6.06 PM
root / root
0644
fix.go
14.027 KB
4 Dec 2025 6.06 PM
root / root
0644
gotypes.go
1.689 KB
4 Dec 2025 6.06 PM
root / root
0644
jnitype.go
1.244 KB
4 Dec 2025 6.06 PM
root / root
0644
main.go
5.558 KB
4 Dec 2025 6.06 PM
root / root
0644
netipv6zone.go
1.319 KB
4 Dec 2025 6.06 PM
root / root
0644
printerconfig.go
1.106 KB
4 Dec 2025 6.06 PM
root / root
0644
typecheck.go
20.095 KB
4 Dec 2025 6.06 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF