棄用 API
最後更新
依「從哪個版本開始棄用」列出標準庫中所有標記為 Deprecated 的 API;棄用的 API 仍可編譯,但官方建議改用說明中的替代做法,本書範例一律不使用。
棄用版本的判定方式:比對每個 Go 主版本的原始碼,找出該 API 的文件註解第一次出現
Deprecated: 的版本。go1.27
Go 版本頁
| 套件 | 符號 | 官方說明 |
|---|---|---|
crypto/tls | Config.Rand | this should be left nil in production. Not all TLS configurations are guaranteed to use Rand. Test code can use [testing/cryptotest.SetGlobalRandom] instead. |
go1.26
Go 版本頁
| 套件 | 符號 | 官方說明 |
|---|---|---|
crypto/ecdsa | PrivateKey.D | modifying the raw value can produce invalid keys, and may invalidate internal optimizations; moreover, [big.Int] methods are not suitable for operating on cryptographic values. To encode and decode PrivateKey values, use [PrivateKey.Bytes] and [ParseRawPrivateKey] or [crypto/x509.MarshalPKCS8PrivateKey] and [crypto/x509.ParsePKCS8PrivateKey]. For ECDH, use [crypto/ecdh]. |
crypto/ecdsa | PublicKey.X | modifying the raw coordinates can produce invalid keys, and may invalidate internal optimizations; moreover, [big.Int] methods are not suitable for operating on cryptographic values. To encode and decode PublicKey values, use [PublicKey.Bytes] and [ParseUncompressedPublicKey] or [crypto/x509.MarshalPKIXPublicKey] and [crypto/x509.ParsePKIXPublicKey]. For ECDH, use [crypto/ecdh]. For lower-level elliptic curve operations, use a third-party module like filippo.io/nistec. |
crypto/ecdsa | PublicKey.Y | modifying the raw coordinates can produce invalid keys, and may invalidate internal optimizations; moreover, [big.Int] methods are not suitable for operating on cryptographic values. To encode and decode PublicKey values, use [PublicKey.Bytes] and [ParseUncompressedPublicKey] or [crypto/x509.MarshalPKIXPublicKey] and [crypto/x509.ParsePKIXPublicKey]. For ECDH, use [crypto/ecdh]. For lower-level elliptic curve operations, use a third-party module like filippo.io/nistec. |
crypto/rsa | DecryptPKCS1v15 | PKCS #1 v1.5 encryption is dangerous and should not be used. Whether this function returns an error or not discloses secret information. If an attacker can cause this function to run repeatedly and learn whether each instance returned an error then they can decrypt and forge signatures as if they had the private key. See [draft-irtf-cfrg-rsa-guidance-05] for more information. Use [EncryptOAEP] and [DecryptOAEP] instead. |
crypto/rsa | DecryptPKCS1v15SessionKey | PKCS #1 v1.5 encryption is dangerous and should not be used. The protections implemented by this function are limited and fragile, as explained above. See [draft-irtf-cfrg-rsa-guidance-05] for more information. Use [EncryptOAEP] and [DecryptOAEP] instead. |
crypto/rsa | EncryptPKCS1v15 | PKCS #1 v1.5 encryption is dangerous and should not be used. See [draft-irtf-cfrg-rsa-guidance-05] for more information. Use [EncryptOAEP] and [DecryptOAEP] instead. |
crypto/rsa | PKCS1v15DecryptOptions | PKCS #1 v1.5 encryption is dangerous and should not be used. See [draft-irtf-cfrg-rsa-guidance-05] for more information. Use [EncryptOAEP] and [DecryptOAEP] instead. |
net/http/httputil | ReverseProxy.Director | Use Rewrite instead. |
go1.25
Go 版本頁
| 套件 | 符號 | 官方說明 |
|---|---|---|
go/ast | FilterFuncDuplicates | use the type checker [go/types] instead of [Package]; see [Object]. |
go/ast | FilterImportDuplicates | use the type checker [go/types] instead of [Package]; see [Object]. |
go/ast | FilterPackage | use the type checker [go/types] instead of [Package]; see [Object]. Alternatively, use [FilterFile]. |
go/ast | FilterUnassociatedComments | use the type checker [go/types] instead of [Package]; see [Object]. |
go/ast | MergeMode | use the type checker [go/types] instead of [Package]; see [Object]. |
go/ast | MergePackageFiles | this function is poorly specified and has unfixable bugs; also [Package] is deprecated. |
go/ast | PackageExports | use the type checker [go/types] instead of [Package]; see [Object]. Alternatively, use [FileExports]. |
go/parser | ParseDir | ParseDir does not consider build tags when associating files with packages. For precise information about the relationship between packages and files, use golang.org/x/tools/go/packages, which can also optionally parse and type-check the files too. |
go1.24
Go 版本頁
| 套件 | 符號 | 官方說明 |
|---|---|---|
crypto/cipher | NewCFBDecrypter | CFB mode is not authenticated, which generally enables active attacks to manipulate and recover the plaintext. It is recommended that applications use [AEAD] modes instead. The standard library implementation of CFB is also unoptimized and not validated as part of the FIPS 140-3 module. If an unauthenticated [Stream] mode is required, use [NewCTR] instead. |
crypto/cipher | NewCFBEncrypter | CFB mode is not authenticated, which generally enables active attacks to manipulate and recover the plaintext. It is recommended that applications use [AEAD] modes instead. The standard library implementation of CFB is also unoptimized and not validated as part of the FIPS 140-3 module. If an unauthenticated [Stream] mode is required, use [NewCTR] instead. |
crypto/cipher | NewOFB | OFB mode is not authenticated, which generally enables active attacks to manipulate and recover the plaintext. It is recommended that applications use [AEAD] modes instead. The standard library implementation of OFB is also unoptimized and not validated as part of the FIPS 140-3 module. If an unauthenticated [Stream] mode is required, use [NewCTR] instead. |
runtime | GOROOT | The root used during the Go build will not be meaningful if the binary is copied to another machine. Use the system path to locate the “go” binary, and use “go env GOROOT” to find its GOROOT. |
go1.22
Go 版本頁
| 套件 | 符號 | 官方說明 |
|---|---|---|
go/ast | Importer | use the type checker [go/types] instead; see [Object]. |
go/ast | NewPackage | use the type checker [go/types] instead; see [Object]. |
go/ast | Object | The relationship between Idents and Objects cannot be correctly computed without type information. For example, the expression T{K: 0} may denote a struct, map, slice, or array literal, depending on the type of T. If T is a struct, then K refers to a field of T, whereas for the other types it refers to a value in the environment. |
go/ast | Package | use the type checker [go/types] instead; see [Object]. |
go/ast | Scope | use the type checker [go/types] instead; see [Object]. |
html/template | ErrJSTemplate | ErrJSTemplate is no longer returned when an action is present in a JS template literal. Actions inside of JS template literals are now escaped as expected. |
reflect | PtrTo | Superseded by [PointerTo]. |
go1.21
Go 版本頁
| 套件 | 符號 | 官方說明 |
|---|---|---|
crypto/elliptic | Curve.Add | this is a low-level unsafe API. |
crypto/elliptic | Curve.Double | this is a low-level unsafe API. |
crypto/elliptic | Curve.IsOnCurve | this is a low-level unsafe API. For ECDH, use the crypto/ecdh package. The NewPublicKey methods of NIST curves in crypto/ecdh accept the same encoding as the Unmarshal function, and perform on-curve checks. |
crypto/elliptic | Curve.ScalarBaseMult | this is a low-level unsafe API. For ECDH, use the crypto/ecdh package. Most uses of ScalarBaseMult can be replaced by a call to the PrivateKey.PublicKey method in crypto/ecdh. |
crypto/elliptic | Curve.ScalarMult | this is a low-level unsafe API. For ECDH, use the crypto/ecdh package. Most uses of ScalarMult can be replaced by a call to the ECDH methods of NIST curves in crypto/ecdh. |
crypto/elliptic | CurveParams.Add | the [CurveParams] methods are deprecated and are not guaranteed to provide any security property. For ECDH, use the [crypto/ecdh] package. For ECDSA, use the [crypto/ecdsa] package with a [Curve] value returned directly from [P224], [P256], [P384], or [P521]. |
crypto/elliptic | CurveParams.Double | the [CurveParams] methods are deprecated and are not guaranteed to provide any security property. For ECDH, use the [crypto/ecdh] package. For ECDSA, use the [crypto/ecdsa] package with a [Curve] value returned directly from [P224], [P256], [P384], or [P521]. |
crypto/elliptic | CurveParams.IsOnCurve | the [CurveParams] methods are deprecated and are not guaranteed to provide any security property. For ECDH, use the [crypto/ecdh] package. For ECDSA, use the [crypto/ecdsa] package with a [Curve] value returned directly from [P224], [P256], [P384], or [P521]. |
crypto/elliptic | CurveParams.ScalarBaseMult | the [CurveParams] methods are deprecated and are not guaranteed to provide any security property. For ECDH, use the [crypto/ecdh] package. For ECDSA, use the [crypto/ecdsa] package with a [Curve] value returned directly from [P224], [P256], [P384], or [P521]. |
crypto/elliptic | CurveParams.ScalarMult | the [CurveParams] methods are deprecated and are not guaranteed to provide any security property. For ECDH, use the [crypto/ecdh] package. For ECDSA, use the [crypto/ecdsa] package with a [Curve] value returned directly from [P224], [P256], [P384], or [P521]. |
crypto/elliptic | GenerateKey | for ECDH, use the GenerateKey methods of the [crypto/ecdh] package; for ECDSA, use the GenerateKey function of the crypto/ecdsa package. |
crypto/elliptic | Marshal | for ECDH, use the crypto/ecdh package. This function returns an encoding equivalent to that of PublicKey.Bytes in crypto/ecdh. |
crypto/elliptic | Unmarshal | for ECDH, use the crypto/ecdh package. This function accepts an encoding equivalent to that of the NewPublicKey methods in crypto/ecdh. |
crypto/rsa | GenerateMultiPrimeKey | The use of this function with a number of primes different from two is not recommended for the above security, compatibility, and performance reasons. Use [GenerateKey] instead. |
crypto/rsa | PrecomputedValues.CRTValues | These values are still filled in by Precompute for backwards compatibility but are not used. Multi-prime RSA is very rare, and is implemented by this package without CRT optimizations to limit complexity. |
crypto/x509 | RevocationList.RevokedCertificates | Use RevokedCertificateEntries instead. |
reflect | SliceHeader | Use unsafe.Slice or unsafe.SliceData instead. |
reflect | StringHeader | Use unsafe.String or unsafe.StringData instead. |
go1.20
Go 版本頁
| 套件 | 符號 | 官方說明 |
|---|---|---|
math/rand | Read | For almost all use cases, [crypto/rand.Read] is more appropriate. If a deterministic source is required, use [math/rand/v2.ChaCha8.Read]. |
math/rand | Seed | As of Go 1.20 there is no reason to call Seed with a random value. Programs that call Seed with a known value to get a specific sequence of results should use New(NewSource(seed)) to obtain a local random generator. |
go1.19
Go 版本頁
| 套件 | 符號 | 官方說明 |
|---|---|---|
crypto/x509 | Certificate.CheckCRLSignature | Use [RevocationList.CheckSignatureFrom] instead. |
crypto/x509 | Certificate.CreateCRL | this method does not generate an RFC 5280 conformant X.509 v2 CRL. To generate a standards compliant CRL, use [CreateRevocationList] instead. |
crypto/x509 | ParseCRL | Use [ParseRevocationList] instead. |
crypto/x509 | ParseDERCRL | Use [ParseRevocationList] instead. |
crypto/x509/pkix | CertificateList | x509.RevocationList should be used instead. |
crypto/x509/pkix | TBSCertificateList | x509.RevocationList should be used instead. |
go/doc | Synopsis | New programs should use [Package.Synopsis] instead, which handles links in text properly. |
go/doc | ToHTML | ToHTML cannot identify documentation links in the doc comment, because they depend on knowing what package the text came from, which is not included in this API. |
go/doc | ToText | ToText cannot identify documentation links in the doc comment, because they depend on knowing what package the text came from, which is not included in this API. |
io/ioutil | (package) | As of Go 1.16, the same functionality is now provided by package [io] or package [os], and those implementations should be preferred in new code. See the specific function documentation for details. |
io/ioutil | Discard | As of Go 1.16, this value is simply [io.Discard]. |
io/ioutil | NopCloser | As of Go 1.16, this function simply calls [io.NopCloser]. |
io/ioutil | ReadAll | As of Go 1.16, this function simply calls [io.ReadAll]. |
io/ioutil | ReadDir | As of Go 1.16, [os.ReadDir] is a more efficient and correct choice: it returns a list of [fs.DirEntry] instead of [fs.FileInfo], and it returns partial results in the case of an error midway through reading a directory. |
io/ioutil | ReadFile | As of Go 1.16, this function simply calls [os.ReadFile]. |
io/ioutil | TempDir | As of Go 1.17, this function simply calls [os.MkdirTemp]. |
io/ioutil | TempFile | As of Go 1.17, this function simply calls [os.CreateTemp]. |
io/ioutil | WriteFile | As of Go 1.16, this function simply calls [os.WriteFile]. |
go1.18
Go 版本頁
| 套件 | 符號 | 官方說明 |
|---|---|---|
bytes | Title | The rule Title uses for word boundaries does not handle Unicode punctuation properly. Use golang.org/x/text/cases instead. |
crypto/tls | Config.PreferServerCipherSuites | PreferServerCipherSuites is ignored. |
crypto/x509 | CertPool.Subjects | if s was returned by [SystemCertPool], Subjects will not include the system roots. |
go/types | Interface.Embedded | Use [Interface.EmbeddedType] which is not restricted to defined (*[Named]) types. |
go/types | NewInterface | Use NewInterfaceType instead which allows arbitrary embedded types. |
go/types | NewSignature | Use [NewSignatureType] instead which allows for type parameters. |
net | Error.Temporary | Temporary errors are not well-defined. Most "temporary" errors are timeouts, and the few exceptions are surprising. Do not use this method. |
strings | Title | The rule Title uses for word boundaries does not handle Unicode punctuation properly. Use golang.org/x/text/cases instead. |
syscall | Syscall | Use [SyscallN] instead. |
syscall | Syscall12 | Use [SyscallN] instead. |
syscall | Syscall15 | Use [SyscallN] instead. |
syscall | Syscall18 | Use [SyscallN] instead. |
syscall | Syscall6 | Use [SyscallN] instead. |
syscall | Syscall9 | Use [SyscallN] instead. |
go1.17
Go 版本頁
| 套件 | 符號 | 官方說明 |
|---|---|---|
reflect | Value.InterfaceData | The memory representation of interface values is not compatible with InterfaceData. |
syscall | CreateIoCompletionPort | CreateIoCompletionPort has the wrong function signature. Use x/sys/windows.CreateIoCompletionPort. |
syscall | GetQueuedCompletionStatus | GetQueuedCompletionStatus has the wrong function signature. Use x/sys/windows.GetQueuedCompletionStatus. |
syscall | PostQueuedCompletionStatus | PostQueuedCompletionStatus has the wrong function signature. Use x/sys/windows.PostQueuedCompletionStatus. |
go1.16
Go 版本頁
| 套件 | 符號 | 官方說明 |
|---|---|---|
crypto/dsa | (package) | DSA is a legacy algorithm, and modern alternatives such as Ed25519 (implemented by package crypto/ed25519) should be used instead. Keys with 1024-bit moduli (L1024N160 parameters) are cryptographically weak, while bigger keys are not widely supported. Note that FIPS 186-5 no longer approves DSA for signature generation. |
crypto/x509 | DecryptPEMBlock | Legacy PEM encryption as specified in RFC 1423 is insecure by design. Since it does not authenticate the ciphertext, it is vulnerable to padding oracle attacks that can let an attacker recover the plaintext. |
crypto/x509 | EncryptPEMBlock | Legacy PEM encryption as specified in RFC 1423 is insecure by design. Since it does not authenticate the ciphertext, it is vulnerable to padding oracle attacks that can let an attacker recover the plaintext. |
crypto/x509 | IsEncryptedPEMBlock | Legacy PEM encryption as specified in RFC 1423 is insecure by design. Since it does not authenticate the ciphertext, it is vulnerable to padding oracle attacks that can let an attacker recover the plaintext. |
go1.15
Go 版本頁
| 套件 | 符號 | 官方說明 |
|---|---|---|
crypto/tls | Config.SessionTicketKey | if this field is left at zero, session ticket keys will be automatically rotated every day and dropped after seven days. For customizing the rotation schedule or synchronizing servers that are terminating connections for the same host, use SetSessionTicketKeys. |
crypto/tls | ConnectionState.NegotiatedProtocolIsMutual | this value is always true. |
go1.14
Go 版本頁
| 套件 | 符號 | 官方說明 |
|---|---|---|
crypto/tls | Config.BuildNameToCertificate | NameToCertificate only allows associating a single certificate with a given name. Leave that field nil to let the library select the first compatible chain from Certificates. |
crypto/tls | Config.NameToCertificate | NameToCertificate only allows associating a single certificate with a given name. Leave this field nil to let the library select the first compatible chain from Certificates. |
net/http | Transport.DialTLS | Use DialTLSContext instead, which allows the transport to cancel dials as soon as they are no longer needed. If both are set, DialTLSContext takes priority. |
go1.13
Go 版本頁
| 套件 | 符號 | 官方說明 |
|---|---|---|
crypto/tls | VersionSSL30 | SSLv3 is cryptographically broken, and is no longer supported by this package. See golang.org/issue/32716. |
debug/gosym | LineTable.LineToPC | Use Table's LineToPC method instead. |
debug/gosym | LineTable.PCToLine | Use Table's PCToLine method instead. |
image | ZP | Use a literal [image.Point] instead. |
image | ZR | Use a literal [image.Rectangle] instead. |
go1.12
Go 版本頁
| 套件 | 符號 | 官方說明 |
|---|---|---|
crypto/rc4 | Cipher.Reset | Reset can't guarantee that the key will be entirely removed from the process's memory. |
crypto/x509 | CertificateRequest.Attributes | Use Extensions and ExtraExtensions instead for parsing and generating the requestedExtensions attribute. |
go/importer | For | Use [ForCompiler], which populates a FileSet with the positions of objects created by the importer. |
net | Dialer.DualStack | Fast Fallback is enabled by default. To disable, set FallbackDelay to a negative value. |
net/http | ErrUnexpectedTrailer | ErrUnexpectedTrailer is no longer returned by anything in the net/http package. Callers should not compare errors against this variable. |
regexp | Regexp.Copy | In earlier releases, when using a [Regexp] in multiple goroutines, giving each goroutine its own copy helped to avoid lock contention. As of Go 1.12, using Copy is no longer necessary to avoid lock contention. Copy may still be appropriate if the reason for its use is to make two copies with different [Regexp.Longest] settings. |
go1.11
Go 版本頁
| 套件 | 符號 | 官方說明 |
|---|---|---|
archive/tar | TypeRegA | Use TypeReg instead. |
net/http | CloseNotifier | the CloseNotifier interface predates Go's context package. New code should use [Request.Context] instead. |
net/http/httptest | ResponseRecorder.HeaderMap | HeaderMap exists for historical compatibility and should not be used. To access the headers returned by a handler, use the Response.Header map as returned by the Result method. |
go1.10
Go 版本頁
| 套件 | 符號 | 官方說明 |
|---|---|---|
archive/tar | Header.Xattrs | Use PAXRecords instead. |
archive/zip | FileHeader.ModTime | Use [Modified] instead. |
archive/zip | FileHeader.ModifiedDate | Use Modified instead. |
archive/zip | FileHeader.ModifiedTime | Use Modified instead. |
archive/zip | FileHeader.SetModTime | Use [Modified] instead. |
encoding/csv | ErrTrailingComma | ErrTrailingComma is no longer used. |
encoding/csv | Reader.TrailingComma | TrailingComma is no longer used. |
go1.9
Go 版本頁
| 套件 | 符號 | 官方說明 |
|---|---|---|
database/sql/driver | ColumnConverter | Drivers should implement [NamedValueChecker]. |
runtime | CPUProfile | Use the [runtime/pprof] package, or the handlers in the [net/http/pprof] package, or the [testing] package's -test.cpuprofile flag instead. |
go1.8
Go 版本頁
| 套件 | 符號 | 官方說明 |
|---|---|---|
database/sql/driver | Conn.Begin | Drivers should implement ConnBeginTx instead (or additionally). |
database/sql/driver | Execer | Drivers should implement [ExecerContext] instead. |
database/sql/driver | Queryer | Drivers should implement [QueryerContext] instead. |
database/sql/driver | Stmt.Exec | Drivers should implement StmtExecContext instead (or additionally). |
database/sql/driver | Stmt.Query | Drivers should implement StmtQueryContext instead (or additionally). |
net/http | ErrHeaderTooLong | ErrHeaderTooLong is no longer returned by anything in the net/http package. Callers should not compare errors against this variable. |
net/http | ErrMissingContentLength | ErrMissingContentLength is no longer returned by anything in the net/http package. Callers should not compare errors against this variable. |
net/http | ErrShortBody | ErrShortBody is no longer returned by anything in the net/http package. Callers should not compare errors against this variable. |
net/http | ProtocolError | Not all errors in the http package related to protocol errors are of type ProtocolError. |
net/http/httputil | ErrClosed | No longer used. |
net/http/httputil | ErrPersistEOF | No longer used. |
net/http/httputil | ErrPipeline | No longer used. |
path/filepath | HasPrefix | HasPrefix does not respect path boundaries and does not ignore case when required. |
go1.7
Go 版本頁
| 套件 | 符號 | 官方說明 |
|---|---|---|
go/build | AllowBinary | The supported way to create a compiled-only package is to write source code containing a //go:binary-only-package comment at the top of the file. Such a package will be recognized regardless of this flag setting (because it has source code) and will have BinaryOnly set to true in the returned Package. |
net | Dialer.Cancel | Use DialContext instead. |
net/http | ErrWriteAfterFlush | ErrWriteAfterFlush is no longer returned by anything in the net/http package. Callers should not compare errors against this variable. |
net/http | Request.Cancel | Set the Request's context with NewRequestWithContext instead. If a Request's Cancel field and context are both set, it is undefined whether Cancel is respected. |
net/http | Transport.Dial | Use DialContext instead, which allows the transport to cancel dials as soon as they are no longer needed. If both are set, DialContext takes priority. |
net/http/httputil | ClientConn | Use Client or Transport in package [net/http] instead. |
net/http/httputil | NewClientConn | Use the Client or Transport in package [net/http] instead. |
net/http/httputil | NewProxyClientConn | Use the Client or Transport in package [net/http] instead. |
net/http/httputil | NewServerConn | Use the Server in package [net/http] instead. |
net/http/httputil | ServerConn | Use the Server in package [net/http] instead. |
os | SEEK_CUR | Use io.SeekStart, io.SeekCurrent, and io.SeekEnd. |
os | SEEK_END | Use io.SeekStart, io.SeekCurrent, and io.SeekEnd. |
os | SEEK_SET | Use io.SeekStart, io.SeekCurrent, and io.SeekEnd. |
syscall | AttachLsf | Use golang.org/x/net/bpf instead. |
syscall | BpfBuflen | Use golang.org/x/net/bpf instead. |
syscall | BpfDatalink | Use golang.org/x/net/bpf instead. |
syscall | BpfHeadercmpl | Use golang.org/x/net/bpf instead. |
syscall | BpfInterface | Use golang.org/x/net/bpf instead. |
syscall | BpfJump | Use golang.org/x/net/bpf instead. |
syscall | BpfStats | Use golang.org/x/net/bpf instead. |
syscall | BpfStmt | Use golang.org/x/net/bpf instead. |
syscall | BpfTimeout | Use golang.org/x/net/bpf instead. |
syscall | CheckBpfVersion | Use golang.org/x/net/bpf instead. |
syscall | DetachLsf | Use golang.org/x/net/bpf instead. |
syscall | FlushBpf | Use golang.org/x/net/bpf instead. |
syscall | InterfaceAddrMessage | Use golang.org/x/net/route instead. |
syscall | InterfaceAnnounceMessage | Use golang.org/x/net/route instead. |
syscall | InterfaceMessage | Use golang.org/x/net/route instead. |
syscall | InterfaceMulticastAddrMessage | Use golang.org/x/net/route instead. |
syscall | LsfJump | Use golang.org/x/net/bpf instead. |
syscall | LsfSocket | Use golang.org/x/net/bpf instead. |
syscall | LsfStmt | Use golang.org/x/net/bpf instead. |
syscall | ParseRoutingMessage | Use golang.org/x/net/route instead. |
syscall | ParseRoutingSockaddr | Use golang.org/x/net/route instead. |
syscall | RouteMessage | Use golang.org/x/net/route instead. |
syscall | RouteRIB | Use golang.org/x/net/route instead. |
syscall | RoutingMessage | Use golang.org/x/net/route instead. |
syscall | SetBpf | Use golang.org/x/net/bpf instead. |
syscall | SetBpfBuflen | Use golang.org/x/net/bpf instead. |
syscall | SetBpfDatalink | Use golang.org/x/net/bpf instead. |
syscall | SetBpfHeadercmpl | Use golang.org/x/net/bpf instead. |
syscall | SetBpfImmediate | Use golang.org/x/net/bpf instead. |
syscall | SetBpfInterface | Use golang.org/x/net/bpf instead. |
syscall | SetBpfPromisc | Use golang.org/x/net/bpf instead. |
syscall | SetBpfTimeout | Use golang.org/x/net/bpf instead. |
syscall | SetLsfPromisc | Use golang.org/x/net/bpf instead. |
go1.6
Go 版本頁
| 套件 | 符號 | 官方說明 |
|---|---|---|
compress/flate | ReadError | No longer returned. |
compress/flate | WriteError | No longer returned. |
net/http | Transport.CancelRequest | Use [Request.WithContext] to create a request with a cancelable context instead. CancelRequest cannot cancel HTTP/2 requests. This may become a no-op in a future release of Go. |
go1.5
Go 版本頁
| 套件 | 符號 | 官方說明 |
|---|---|---|
archive/zip | FileHeader.CompressedSize | Use CompressedSize64 instead. |
archive/zip | FileHeader.UncompressedSize | Use UncompressedSize64 instead. |
go/doc | Package.Bugs | For backward compatibility Bugs is still populated, but all new code should use Notes instead. |
image/jpeg | Reader | Reader is not used by the [image/jpeg] package and should not be used by others. It is kept for compatibility. |
syscall | FormatMessage | Use FormatMessage from golang.org/x/sys/windows instead. |
syscall | StringBytePtr | Use [BytePtrFromString] instead. |
syscall | StringByteSlice | Use ByteSliceFromString instead. |
syscall | StringSlicePtr | Use [SlicePtrFromStrings] instead. |
syscall | StringToUTF16 | Use [UTF16FromString] instead. |
syscall | StringToUTF16Ptr | Use [UTF16PtrFromString] instead. |
資料來源
- golang/go 原始碼(各版本 tag 的
Deprecated:註解) - Go 發版歷史