mirror of
https://github.com/golang/go
synced 2024-11-18 07:34:53 -07:00
01f8cd246d
They will be deleted from their current homes once this has landed. Changes made to import paths to make the code compile, and to find errchk in the right place in cmd/vet's Makefile. TODO in a later CL: tidy up vet. R=golang-dev, gri CC=golang-dev https://golang.org/cl/9495043
51 lines
1.3 KiB
Go
51 lines
1.3 KiB
Go
// Copyright 2010 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.
|
|
|
|
// +build !gotypes
|
|
|
|
// This file contains stubs for the pieces of the tool that require the go/types package,
|
|
// to be used if go/types is not available.
|
|
|
|
package main
|
|
|
|
import (
|
|
"go/ast"
|
|
"go/token"
|
|
)
|
|
|
|
// Type is equivalent to go/types.Type. Repeating it here allows us to avoid
|
|
// having main depend on the go/types package.
|
|
type Type interface {
|
|
String() string
|
|
}
|
|
|
|
// ExactValue is a stub for exact.Value. Stubbing it here allows us to
|
|
// avoid having main depend on the go/exact package.
|
|
type ExactValue interface {
|
|
}
|
|
|
|
func (pkg *Package) check(fs *token.FileSet, astFiles []*ast.File) error {
|
|
return nil
|
|
}
|
|
|
|
func (pkg *Package) isStruct(c *ast.CompositeLit) (bool, string) {
|
|
return true, "" // Assume true, so we do the check.
|
|
}
|
|
|
|
func (f *File) matchArgType(t printfArgType, arg ast.Expr) bool {
|
|
return true // We can't tell without types.
|
|
}
|
|
|
|
func (f *File) numArgsInSignature(call *ast.CallExpr) int {
|
|
return 0 // We don't know.
|
|
}
|
|
|
|
func (f *File) isErrorMethodCall(call *ast.CallExpr) bool {
|
|
// Is it a selector expression? Otherwise it's a function call, not a method call.
|
|
if _, ok := call.Fun.(*ast.SelectorExpr); !ok {
|
|
return false
|
|
}
|
|
return true // Best guess we can make without types.
|
|
}
|