mirror of
https://github.com/golang/go.git
synced 2025-05-05 15:43:04 +00:00
Created Deprecated (markdown)
parent
b9bc0d5e77
commit
5b0b2d4f7e
33
Deprecated.md
Normal file
33
Deprecated.md
Normal file
@ -0,0 +1,33 @@
|
||||
Sometimes a struct field, function, type, or even a whole package becomes
|
||||
redundant or unnecessary, but must be kept for compatibility with existing
|
||||
programs.
|
||||
|
||||
To signal that an identifier should not be used, add a paragraph to its doc
|
||||
comment that begins with `Deprecated:` followed by some information about the
|
||||
deprecation, and a recommendation on what to use instead, if applicable.
|
||||
|
||||
[Some tools will warn on use of deprecated identifiers](https://staticcheck.io/docs/checks#SA1019)
|
||||
and their docs [will be hidden by godoc once #17056 is implemented](https://golang.org/issue/17056).
|
||||
|
||||
## Examples
|
||||
|
||||
```
|
||||
type ResponseRecorder struct {
|
||||
// HeaderMap contains the headers explicitly set by the Handler.
|
||||
// It is an internal detail.
|
||||
//
|
||||
// Deprecated: 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.
|
||||
HeaderMap http.Header
|
||||
```
|
||||
|
||||
```
|
||||
// Package rc4 implements the RC4 stream cipher.
|
||||
//
|
||||
// Deprecated: RC4 is cryptographically broken and should not be used
|
||||
// except for compatibility with legacy systems.
|
||||
package rc4
|
||||
```
|
||||
|
||||
There are a few other examples [in the standard library](https://golang.org/search?q=deprecated).
|
Loading…
x
Reference in New Issue
Block a user