...

Source file src/cmd/vendor/golang.org/x/tools/go/analysis/passes/stdmethods/doc.go

Documentation: cmd/vendor/golang.org/x/tools/go/analysis/passes/stdmethods

     1  // Copyright 2023 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Package stdmethods defines an Analyzer that checks for misspellings
     6  // in the signatures of methods similar to well-known interfaces.
     7  //
     8  // # Analyzer stdmethods
     9  //
    10  // stdmethods: check signature of methods of well-known interfaces
    11  //
    12  // Sometimes a type may be intended to satisfy an interface but may fail to
    13  // do so because of a mistake in its method signature.
    14  // For example, the result of this WriteTo method should be (int64, error),
    15  // not error, to satisfy io.WriterTo:
    16  //
    17  //	type myWriterTo struct{...}
    18  //	func (myWriterTo) WriteTo(w io.Writer) error { ... }
    19  //
    20  // This check ensures that each method whose name matches one of several
    21  // well-known interface methods from the standard library has the correct
    22  // signature for that interface.
    23  //
    24  // Checked method names include:
    25  //
    26  //	Format GobEncode GobDecode MarshalJSON MarshalXML
    27  //	Peek ReadByte ReadFrom ReadRune Scan Seek
    28  //	UnmarshalJSON UnreadByte UnreadRune WriteByte
    29  //	WriteTo
    30  package stdmethods
    31  

View as plain text