// stubMissingInterfaceMethodsFixer returns a suggested fix to declare the missing // methods of the concrete type that is assigned to an interface type // at the cursor position. func stubMissingInterfaceMethodsFixer(ctx context.Context, snapshot *cache.Snapshot, pkg *cache.Package, pgf *parsego.File, start, end token.Pos) (*token.FileSet, *analysis.SuggestedFix, error) { … } // stubMissingCalledFunctionFixer returns a suggested fix to declare the missing // method that the user may want to generate based on CallExpr // at the cursor position. func stubMissingCalledFunctionFixer(ctx context.Context, snapshot *cache.Snapshot, pkg *cache.Package, pgf *parsego.File, start, end token.Pos) (*token.FileSet, *analysis.SuggestedFix, error) { … } type emitter … // insertDeclsAfter locates the file that declares symbol sym, // (which must be among the dependencies of mp), // calls the emit function to generate new declarations, // respecting the local import environment, // and splices those declarations into the file after the declaration of sym, // updating imports as needed. // // fset must provide the position of sym. func insertDeclsAfter(ctx context.Context, snapshot *cache.Snapshot, mp *metadata.Package, fset *token.FileSet, sym types.Object, emit emitter) (*token.FileSet, *analysis.SuggestedFix, error) { … } // diffToTextEdits converts diff (offset-based) edits to analysis (token.Pos) form. func diffToTextEdits(tok *token.File, diffs []diff.Edit) []analysis.TextEdit { … } // trimVersionSuffix removes a trailing "/v2" (etc) suffix from a module path. // // This is only a heuristic as to the package's declared name, and // should only be used for stylistic decisions, such as whether it // would be clearer to use an explicit local name in the import // because the declared name differs from the result of this function. // When the name matters for correctness, look up the imported // package's Metadata.Name. func trimVersionSuffix(path string) string { … }