Some were never used, and some haven't been used for years.
One exception is net/http's readerAndCloser, which was only used in a
test. Move it to a test file.
While at it, remove a check in regexp that could never fire; the field
is an uint32, so it can never be negative.
Change-Id: Ia2200f6afa106bae4034045ea8233b452f38747b
Reviewed-on: https://go-review.googlesource.com/c/go/+/192621
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
return si.Query(dargs)
}
-var errLevelNotSupported = errors.New("sql: selected isolation level is not supported")
-
func ctxDriverBegin(ctx context.Context, opts *TxOptions, ci driver.Conn) (driver.Tx, error) {
if ciCtx, is := ci.(driver.ConnBeginTx); is {
dopts := driver.TxOptions{}
Struct struct{}
}
-type NullTestStrings struct {
- Bool bool `json:",string"`
- Int int `json:",string"`
- Int8 int8 `json:",string"`
- Int16 int16 `json:",string"`
- Int32 int32 `json:",string"`
- Int64 int64 `json:",string"`
- Uint uint `json:",string"`
- Uint8 uint8 `json:",string"`
- Uint16 uint16 `json:",string"`
- Uint32 uint32 `json:",string"`
- Uint64 uint64 `json:",string"`
- Float32 float32 `json:",string"`
- Float64 float64 `json:",string"`
- String string `json:",string"`
- PBool *bool `json:",string"`
- Map map[string]string `json:",string"`
- Slice []string `json:",string"`
- Interface interface{} `json:",string"`
-
- PRaw *RawMessage `json:",string"`
- PTime *time.Time `json:",string"`
- PBigInt *big.Int `json:",string"`
- PText *MustNotUnmarshalText `json:",string"`
- PBuffer *bytes.Buffer `json:",string"`
- PStruct *struct{} `json:",string"`
-
- Raw RawMessage `json:",string"`
- Time time.Time `json:",string"`
- BigInt big.Int `json:",string"`
- Text MustNotUnmarshalText `json:",string"`
- Buffer bytes.Buffer `json:",string"`
- Struct struct{} `json:",string"`
-}
-
// JSON null values should be ignored for primitives and string values instead of resulting in an error.
// Issue 2540
func TestUnmarshalNulls(t *testing.T) {
type T1 struct{}
type T2 struct{}
-type T3 struct{}
type IndirComment struct {
T1 T1
word unsafe.Pointer
}
-// nonEmptyInterface is the header for an interface value with methods.
-type nonEmptyInterface struct {
- // see ../runtime/iface.go:/Itab
- itab *struct {
- ityp *rtype // static interface type
- typ *rtype // dynamic concrete type
- hash uint32 // copy of typ.hash
- _ [4]byte
- fun [100000]unsafe.Pointer // method table
- }
- word unsafe.Pointer
-}
-
// mustBeExported panics if f records that the value was obtained using
// an unexported field.
func (f flag) mustBeExported() {
{true, true},
}
+type readerAndCloser struct {
+ io.Reader
+ io.Closer
+}
+
// TestReadResponseCloseInMiddle tests that closing a body after
// reading only part of its contents advances the read to the end of
// the request, right up until the next request.
errCloseIdleConns = errors.New("http: CloseIdleConnections called")
errReadLoopExiting = errors.New("http: persistConn.readLoop exiting")
errIdleConnTimeout = errors.New("http: idle connection timeout")
- errNotCachingH2Conn = errors.New("http: not caching alternate protocol's connections")
// errServerClosedIdle is not seen by users for idempotent requests, but may be
// seen by a user if the server shuts down an idle connection and sends its FIN
}
}
-// The connect method and the transport can both specify a TLS
-// Host name. The transport's name takes precedence if present.
-func chooseTLSHost(cm connectMethod, t *Transport) string {
- tlsHost := ""
- if t.TLSClientConfig != nil {
- tlsHost = t.TLSClientConfig.ServerName
- }
- if tlsHost == "" {
- tlsHost = cm.tlsHost()
- }
- return tlsHost
-}
-
// Add TLS to a persistent connection, i.e. negotiate a TLS session. If pconn is already a TLS
// tunnel, this function establishes a nested TLS session inside the encrypted channel.
// The remote endpoint's name may be overridden by TLSClientConfig.ServerName.
return gz.body.Close()
}
-type readerAndCloser struct {
- io.Reader
- io.Closer
-}
-
type tlsHandshakeTimeoutError struct{}
func (tlsHandshakeTimeoutError) Timeout() bool { return true }
return u
}
-func currentGroup() (*Group, error) {
- return lookupUnixGid(syscall.Getgid())
-}
-
func lookupGroup(groupname string) (*Group, error) {
var grp C.struct_group
var result *C.struct_group
return pkgPathName.name()
}
-// round n up to a multiple of a. a must be a power of 2.
-func round(n, a uintptr) uintptr {
- return (n + a - 1) &^ (a - 1)
-}
-
func newName(n, tag string, exported bool) name {
if len(n) > 1<<16-1 {
panic("reflect.nameFrom: name too long: " + n)
return t.nameOff(ut.pkgPath).name()
}
-func hasPrefix(s, prefix string) bool {
- return len(s) >= len(prefix) && s[:len(prefix)] == prefix
-}
-
func (t *rtype) hasName() bool {
return t.tflag&tflagNamed != 0
}
b.cap[inst.Arg] = pos
continue
} else {
- if 0 <= inst.Arg && inst.Arg < uint32(len(b.cap)) {
+ if inst.Arg < uint32(len(b.cap)) {
// Capture pos to register, but save old value.
b.push(re, pc, b.cap[inst.Arg], true) // come back when we're done.
b.cap[inst.Arg] = pos