sourcegraph / go-langserver

Go language server to add Go support to editors and other tools that use the Language Server Protocol (LSP)
https://sourcegraph.com
MIT License
1.17k stars 89 forks source link

Error in go-langserver: No Content-Length header #313

Closed seagle0128 closed 6 years ago

seagle0128 commented 6 years ago

Today, I upgraded Golang to 1.11.0 from 1.10.3. And I updated go-langserver. Then I got this error while using auto-completion.

error in process filter: Error parsing language server output: (error No Content-Length header)
...
Error from the Language Server: no declaration found for fmt.println (Unknown error)

Backtrace:

Debugger entered--Lisp error: (error "Error parsing language server output: (error No Content-Length header)")
  signal(error ("Error parsing language server output: (error No Content-Length header)"))
  error("Error parsing language server output: %s" (error "No Content-Length header"))
  #f(compiled-function (proc output) #<bytecode 0x431cdf99>)(#<process lsp-go> "Content-Length: 253\015\n\015\n{\"id\":43,\"result\":{\"isIncomplete\":false,\"items\":[{\"label\":\"PANIC\",\"detail\":\"PANIC\",\"insertText\":\"PANIC\",\"insertTextFormat\":1,\"textEdit\":{\"range\":{\"start\":{\"line\":167,\"character\":9},\"end\":{\"line\":167,\"character\":9}},\"newText\":\"PANIC\"}}]},\"jsonrpc\":\"2.0\"}panic: unknown export format version -1 (\"i\\x00\\xa2\\x98\\x01\\xbe\\xf8\\x01\\x1e$GOROOT/src/net/http/client.go\\x00\\tTransport\\fRoundTripper\\rCheckRedirect\\x03req\\aRequest\\x03via\\x03Jar\\tCookieJar\\aTimeout\\bDuration\\x04time\\x04send\\x01c\\x06Client\\bdeadline\\x04Time\\x04resp\\bResponse\")\n1(runtime.call32): /usr/local/Cellar/go/1.11/libexec/src/runtime/asm_amd64.s:522\n2(runtime.gopanic): /usr/local/Cellar/go/1.11/libexec/src/runtime/panic.go:513\n3(github.com/sourcegraph/go-langserver/langserver/internal/gocode.(*gc_bin_parser).parse_export): /Users/vincent/go/src/github.com/sourcegraph/go-langserver/langserver/internal/gocode/package_bin.go:126\n4(github.com/sourcegraph/go-langserver/langserver/internal/gocode.(*package_file_cache).process_package_data): /Users/vincent/go/src/github.com/sourcegraph/go-langserver/langserver/internal/gocode/package.go:132\n5(github.com/sourcegraph/go-langserver/langserver/internal/gocode.(*package_file_cache).update_cache): /Users/vincent/go/src/github.com/sourcegraph/go-langserver/langserver/internal/gocode/package.go:92\n6(github.com/sourcegraph/go-langserver/langserver/internal/gocode.update_packages.func1): /Users/vincent/go/src/github.com/sourcegraph/go-langserver/langserver/internal/gocode/autocompletecontext.go:439\n7(runtime.goexit): /usr/local/Cellar/go/1.11/libexec/src/runtime/asm_amd64.s:1333\n\n")
  read-event(nil t 0.5)
  sit-for(0.5 t)
  company--fetch-candidates("")
  company-calculate-candidates("")
  company--begin-new()
  company--perform()
  company-auto-begin()
  company-idle-begin(#<buffer deploy.go> #<window 3 on deploy.go> 18159 4423)
  apply(company-idle-begin (#<buffer deploy.go> #<window 3 on deploy.go> 18159 4423))
  timer-event-handler([t 23426 56311 961915 nil company-idle-begin (#<buffer deploy.go> #<window 3 on deploy.go> 18159 4423) nil 0])

I enabled -trace flag and get the output of lsp-go stderr buffer below.

langserver-go: reading on stdin, writing on stdout
--> request #1: initialize: {"processId":87698,"rootPath":"/Users/vincent/junk/2018/08/","rootUri":"file:///Users/vincent/junk/2018/08/","capabilities":{"workspace":{"applyEdit":true,"executeCommand":{"dynamicRegistration":true}},"textDocument":{"synchronization":{"willSave":true,"didSave":true,"willSaveWaitUntil":true},"symbol":{"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]}},"formatting":{"dynamicRegistration":true},"codeAction":{"dynamicRegistration":true},"completion":{"completionItem":{"snippetSupport":true}}}},"initializationOptions":{"funcSnippetEnabled":true,"gocodeCompletionEnabled":true,"formatTool":"goimports","goimportsLocalPrefix":"","maxParallelism":null,"useBinaryPkgCache":true}}
Passing an initialize rootPath URI ("file:///Users/vincent/junk/2018/08/") is deprecated. Use rootUri instead.
parseLocalPackage error: no more package files found
<-- result #1: initialize: {"capabilities":{"textDocumentSync":2,"hoverProvider":true,"completionProvider":{"triggerCharacters":["."]},"signatureHelpProvider":{"triggerCharacters":["(",","]},"definitionProvider":true,"typeDefinitionProvider":true,"referencesProvider":true,"documentSymbolProvider":true,"workspaceSymbolProvider":true,"implementationProvider":true,"documentFormattingProvider":true,"xworkspaceReferencesProvider":true,"xdefinitionProvider":true,"xworkspaceSymbolByProperties":true}}
--> notif: initialized: {}
--> notif: textDocument/didOpen: {"textDocument":{"uri":"file:///Users/vincent/junk/2018/08/26-143921.go","languageId":"go","version":0,"text":"package main\n\nimport \"fmt\"\n\n// foo ...\nfunc foo() {\n\tfmt.println()\n}\n"}}
--> notif: textDocument/didOpen: {"textDocument":{"uri":"file:///Users/vincent/junk/2018/08/26-143921.go","languageId":"go","version":0,"text":"package main\n\nimport \"fmt\"\n\n// foo ...\nfunc foo() {\n\tfmt.println()\n}\n"}}
--> notif: textDocument/didChange: {"textDocument":{"uri":"file:///Users/vincent/junk/2018/08/26-143921.go","version":1},"contentChanges":[{"text":"package main\n\nimport \"fmt\"\n\n// foo ...\nfunc foo() {\n\tfmt.println()\n}\n"}]}
--> request #2: textDocument/documentSymbol: {"textDocument":{"uri":"file:///Users/vincent/junk/2018/08/26-143921.go"}}
<-- result #2: textDocument/documentSymbol: [{"name":"foo","kind":12,"location":{"uri":"file:///Users/vincent/junk/2018/08/26-143921.go","range":{"start":{"line":5,"character":5},"end":{"line":5,"character":8}}}}]
--> request #3: textDocument/hover: {"textDocument":{"uri":"file:///Users/vincent/junk/2018/08/26-143921.go"},"position":{"line":6,"character":1}}
--> request #4: textDocument/hover: {"textDocument":{"uri":"file:///Users/vincent/junk/2018/08/26-143921.go"},"position":{"line":6,"character":5}}
<-- result #3: textDocument/hover: {"contents":[{"language":"go","value":"package fmt (\"fmt\")"},"Package fmt implements formatted I/O with functions analogous to C's printf and scanf.  The format 'verbs' are derived from C's but are simpler. \n\n### hdr-PrintingPrinting\nThe verbs: \n\nGeneral: \n\n```\n%v\tthe value in a default format\n\twhen printing structs, the plus flag (%+v) adds field names\n%#v\ta Go-syntax representation of the value\n%T\ta Go-syntax representation of the type of the value\n%%\ta literal percent sign; consumes no value\n\n```\nBoolean: \n\n```\n%t\tthe word true or false\n\n```\nInteger: \n\n```\n%b\tbase 2\n%c\tthe character represented by the corresponding Unicode code point\n%d\tbase 10\n%o\tbase 8\n%q\ta single-quoted character literal safely escaped with Go syntax.\n%x\tbase 16, with lower-case letters for a-f\n%X\tbase 16, with upper-case letters for A-F\n%U\tUnicode format: U+1234; same as \"U+%04X\"\n\n```\nFloating-point and complex constituents: \n\n```\n%b\tdecimalless scientific notation with exponent a power of two,\n\tin the manner of strconv.FormatFloat with the 'b' format,\n\te.g. -123456p-78\n%e\tscientific notation, e.g. -1.234456e+78\n%E\tscientific notation, e.g. -1.234456E+78\n%f\tdecimal point but no exponent, e.g. 123.456\n%F\tsynonym for %f\n%g\t%e for large exponents, %f otherwise. Precision is discussed below.\n%G\t%E for large exponents, %F otherwise\n\n```\nString and slice of bytes (treated equivalently with these verbs): \n\n```\n%s\tthe uninterpreted bytes of the string or slice\n%q\ta double-quoted string safely escaped with Go syntax\n%x\tbase 16, lower-case, two characters per byte\n%X\tbase 16, upper-case, two characters per byte\n\n```\nSlice: \n\n```\n%p\taddress of 0th element in base 16 notation, with leading 0x\n\n```\nPointer: \n\n```\n%p\tbase 16 notation, with leading 0x\nThe %b, %d, %o, %x and %X verbs also work with pointers,\nformatting the value exactly as if it were an integer.\n\n```\nThe default format for %v is: \n\n```\nbool:                    %t\nint, int8 etc.:          %d\nuint, uint8 etc.:        %d, %#x if printed with %#v\nfloat32, complex64, etc: %g\nstring:                  %s\nchan:                    %p\npointer:                 %p\n\n```\nFor compound objects, the elements are printed using these rules, recursively, laid out like this: \n\n```\nstruct:             {field0 field1 ...}\narray, slice:       [elem0 elem1 ...]\nmaps:               map[key1:value1 key2:value2 ...]\npointer to above:   \u0026{}, \u0026[], \u0026map[]\n\n```\nWidth is specified by an optional decimal number immediately preceding the verb. If absent, the width is whatever is necessary to represent the value. Precision is specified after the (optional) width by a period followed by a decimal number. If no period is present, a default precision is used. A period with no following number specifies a precision of zero. Examples: \n\n```\n%f     default width, default precision\n%9f    width 9, default precision\n%.2f   default width, precision 2\n%9.2f  width 9, precision 2\n%9.f   width 9, precision 0\n\n```\nWidth and precision are measured in units of Unicode code points, that is, runes. (This differs from C's printf where the units are always measured in bytes.) Either or both of the flags may be replaced with the character '*', causing their values to be obtained from the next operand (preceding the one to format), which must be of type int. \n\nFor most values, width is the minimum number of runes to output, padding the formatted form with spaces if necessary. \n\nFor strings, byte slices and byte arrays, however, precision limits the length of the input to be formatted (not the size of the output), truncating if necessary. Normally it is measured in runes, but for these types when formatted with the %x or %X format it is measured in bytes. \n\nFor floating-point values, width sets the minimum width of the field and precision sets the number of places after the decimal, if appropriate, except that for %g/%G precision sets the maximum number of significant digits (trailing zeros are removed). For example, given 12.345 the format %6.3f prints 12.345 while %.3g prints 12.3. The default precision for %e, %f and %#g is 6; for %g it is the smallest number of digits necessary to identify the value uniquely. \n\nFor complex numbers, the width and precision apply to the two components independently and the result is parenthesized, so %f applied to 1.2+3.4i produces (1.200000+3.400000i). \n\nOther flags: \n\n```\n+\talways print a sign for numeric values;\n\tguarantee ASCII-only output for %q (%+q)\n-\tpad with spaces on the right rather than the left (left-justify the field)\n#\talternate format: add leading 0 for octal (%#o), 0x for hex (%#x);\n\t0X for hex (%#X); suppress 0x for %p (%#p);\n\tfor %q, print a raw (backquoted) string if strconv.CanBackquote\n\treturns true;\n\talways print a decimal point for %e, %E, %f, %F, %g and %G;\n\tdo not remove trailing zeros for %g and %G;\n\twrite e.g. U+0078 'x' if the character is printable for %U (%#U).\n' '\t(space) leave a space for elided sign in numbers (% d);\n\tput spaces between bytes printing strings or slices in hex (% x, % X)\n0\tpad with leading zeros rather than spaces;\n\tfor numbers, this moves the padding after the sign\n\n```\nFlags are ignored by verbs that do not expect them. For example there is no alternate decimal format, so %#d and %d behave identically. \n\nFor each Printf-like function, there is also a Print function that takes no format and is equivalent to saying %v for every operand.  Another variant Println inserts blanks between operands and appends a newline. \n\nRegardless of the verb, if an operand is an interface value, the internal concrete value is used, not the interface itself. Thus: \n\n```\nvar i interface{} = 23\nfmt.Printf(\"%v\\n\", i)\n\n```\nwill print 23. \n\nExcept when printed using the verbs %T and %p, special formatting considerations apply for operands that implement certain interfaces. In order of application: \n\n1. If the operand is a reflect.Value, the operand is replaced by the concrete value that it holds, and printing continues with the next rule. \n\n2. If an operand implements the Formatter interface, it will be invoked. Formatter provides fine control of formatting. \n\n3. If the %v verb is used with the # flag (%#v) and the operand implements the GoStringer interface, that will be invoked. \n\nIf the format (which is implicitly %v for Println etc.) is valid for a string (%s %q %v %x %X), the following two rules apply: \n\n4. If an operand implements the error interface, the Error method will be invoked to convert the object to a string, which will then be formatted as required by the verb (if any). \n\n5. If an operand implements method String() string, that method will be invoked to convert the object to a string, which will then be formatted as required by the verb (if any). \n\nFor compound operands such as slices and structs, the format applies to the elements of each operand, recursively, not to the operand as a whole. Thus %q will quote each element of a slice of strings, and %6.2f will control formatting for each element of a floating-point array. \n\nHowever, when printing a byte slice with a string-like verb (%s %q %x %X), it is treated identically to a string, as a single item. \n\nTo avoid recursion in cases such as \n\n```\ntype X string\nfunc (x X) String() string { return Sprintf(\"\u003c%s\u003e\", x) }\n\n```\nconvert the value before recurring: \n\n```\nfunc (x X) String() string { return Sprintf(\"\u003c%s\u003e\", string(x)) }\n\n```\nInfinite recursion can also be triggered by self-referential data structures, such as a slice that contains itself as an element, if that type has a String method. Such pathologies are rare, however, and the package does not protect against them. \n\nWhen printing a struct, fmt cannot and therefore does not invoke formatting methods such as Error or String on unexported fields. \n\nExplicit argument indexes: \n\nIn Printf, Sprintf, and Fprintf, the default behavior is for each formatting verb to format successive arguments passed in the call. However, the notation [n] immediately before the verb indicates that the nth one-indexed argument is to be formatted instead. The same notation before a '*' for a width or precision selects the argument index holding the value. After processing a bracketed expression [n], subsequent verbs will use arguments n+1, n+2, etc. unless otherwise directed. \n\nFor example, \n\n```\nfmt.Sprintf(\"%[2]d %[1]d\\n\", 11, 22)\n\n```\nwill yield \"22 11\", while \n\n```\nfmt.Sprintf(\"%[3]*.[2]*[1]f\", 12.0, 2, 6)\n\n```\nequivalent to \n\n```\nfmt.Sprintf(\"%6.2f\", 12.0)\n\n```\nwill yield \" 12.00\". Because an explicit index affects subsequent verbs, this notation can be used to print the same values multiple times by resetting the index for the first argument to be repeated: \n\n```\nfmt.Sprintf(\"%d %d %#[1]x %#x\", 16, 17)\n\n```\nwill yield \"16 17 0x10 0x11\". \n\nFormat errors: \n\nIf an invalid argument is given for a verb, such as providing a string to %d, the generated string will contain a description of the problem, as in these examples: \n\n```\nWrong type or unknown verb: %!verb(type=value)\n\tPrintf(\"%d\", hi):          %!d(string=hi)\nToo many arguments: %!(EXTRA type=value)\n\tPrintf(\"hi\", \"guys\"):      hi%!(EXTRA string=guys)\nToo few arguments: %!verb(MISSING)\n\tPrintf(\"hi%d\"):            hi%!d(MISSING)\nNon-int for width or precision: %!(BADWIDTH) or %!(BADPREC)\n\tPrintf(\"%*s\", 4.5, \"hi\"):  %!(BADWIDTH)hi\n\tPrintf(\"%.*s\", 4.5, \"hi\"): %!(BADPREC)hi\nInvalid or invalid use of argument index: %!(BADINDEX)\n\tPrintf(\"%*[2]d\", 7):       %!d(BADINDEX)\n\tPrintf(\"%.[2]d\", 7):       %!d(BADINDEX)\n\n```\nAll errors begin with the string \"%!\" followed sometimes by a single character (the verb) and end with a parenthesized description. \n\nIf an Error or String method triggers a panic when called by a print routine, the fmt package reformats the error message from the panic, decorating it with an indication that it came through the fmt package.  For example, if a String method calls panic(\"bad\"), the resulting formatted message will look like \n\n```\n%!s(PANIC=bad)\n\n```\nThe %!s just shows the print verb in use when the failure occurred. If the panic is caused by a nil receiver to an Error or String method, however, the output is the undecorated string, \"\u003cnil\u003e\". \n\n### hdr-ScanningScanning\nAn analogous set of functions scans formatted text to yield values.  Scan, Scanf and Scanln read from os.Stdin; Fscan, Fscanf and Fscanln read from a specified io.Reader; Sscan, Sscanf and Sscanln read from an argument string. \n\nScan, Fscan, Sscan treat newlines in the input as spaces. \n\nScanln, Fscanln and Sscanln stop scanning at a newline and require that the items be followed by a newline or EOF. \n\nScanf, Fscanf, and Sscanf parse the arguments according to a format string, analogous to that of Printf. In the text that follows, 'space' means any Unicode whitespace character except newline. \n\nIn the format string, a verb introduced by the % character consumes and parses input; these verbs are described in more detail below. A character other than %, space, or newline in the format consumes exactly that input character, which must be present. A newline with zero or more spaces before it in the format string consumes zero or more spaces in the input followed by a single newline or the end of the input. A space following a newline in the format string consumes zero or more spaces in the input. Otherwise, any run of one or more spaces in the format string consumes as many spaces as possible in the input. Unless the run of spaces in the format string appears adjacent to a newline, the run must consume at least one space from the input or find the end of the input. \n\nThe handling of spaces and newlines differs from that of C's scanf family: in C, newlines are treated as any other space, and it is never an error when a run of spaces in the format string finds no spaces to consume in the input. \n\nThe verbs behave analogously to those of Printf. For example, %x will scan an integer as a hexadecimal number, and %v will scan the default representation format for the value. The Printf verbs %p and %T and the flags # and + are not implemented. The verbs %e %E %f %F %g and %G are all equivalent and scan any floating-point or complex value. For float and complex literals in scientific notation, both the decimal (e) and binary (p) exponent formats are supported (for example: \"2.3e+7\" and \"4.5p-8\"). \n\nInput processed by verbs is implicitly space-delimited: the implementation of every verb except %c starts by discarding leading spaces from the remaining input, and the %s verb (and %v reading into a string) stops consuming input at the first space or newline character. \n\nThe familiar base-setting prefixes 0 (octal) and 0x (hexadecimal) are accepted when scanning integers without a format or with the %v verb. \n\nWidth is interpreted in the input text but there is no syntax for scanning with a precision (no %5.2f, just %5f). If width is provided, it applies after leading spaces are trimmed and specifies the maximum number of runes to read to satisfy the verb. For example, \n\n```\nSscanf(\" 1234567 \", \"%5s%d\", \u0026s, \u0026i)\n\n```\nwill set s to \"12345\" and i to 67 while \n\n```\nSscanf(\" 12 34 567 \", \"%5s%d\", \u0026s, \u0026i)\n\n```\nwill set s to \"12\" and i to 34. \n\nIn all the scanning functions, a carriage return followed immediately by a newline is treated as a plain newline (\\r\\n means the same as \\n). \n\nIn all the scanning functions, if an operand implements method Scan (that is, it implements the Scanner interface) that method will be used to scan the text for that operand.  Also, if the number of arguments scanned is less than the number of arguments provided, an error is returned. \n\nAll arguments to be scanned must be either pointers to basic types or implementations of the Scanner interface. \n\nLike Scanf and Fscanf, Sscanf need not consume its entire input. There is no way to recover how much of the input string Sscanf used. \n\nNote: Fscan etc. can read one character (rune) past the input they return, which means that a loop calling a scan routine may skip some of the input.  This is usually a problem only when there is no space between input values.  If the reader provided to Fscan implements ReadRune, that method will be used to read characters.  If the reader also implements UnreadRune, that method will be used to save the character and successive calls will not lose data.  To attach ReadRune and UnreadRune methods to a reader without that capability, use bufio.NewReader. \n\n"]}
parseLocalPackage error: no more package files found
<-- error #4: textDocument/hover: {"code":0,"message":"no declaration found for fmt.println","data":null}
--> notif: textDocument/didChange: {"textDocument":{"uri":"file:///Users/vincent/junk/2018/08/26-143921.go","version":2},"contentChanges":[{"range":{"start":{"line":6,"character":14},"end":{"line":6,"character":14}},"rangeLength":0,"text":"\n"}]}
--> notif: textDocument/didChange: {"textDocument":{"uri":"file:///Users/vincent/junk/2018/08/26-143921.go","version":3},"contentChanges":[{"range":{"start":{"line":7,"character":0},"end":{"line":7,"character":0}},"rangeLength":0,"text":"\t"}]}
--> notif: textDocument/didChange: {"textDocument":{"uri":"file:///Users/vincent/junk/2018/08/26-143921.go","version":4},"contentChanges":[{"range":{"start":{"line":7,"character":1},"end":{"line":7,"character":1}},"rangeLength":0,"text":"f"}]}
--> request #5: textDocument/hover: {"textDocument":{"uri":"file:///Users/vincent/junk/2018/08/26-143921.go"},"position":{"line":7,"character":2}}
parseLocalPackage error: no more package files found
<-- error #5: textDocument/hover: {"code":0,"message":"no declaration found for f","data":null}
--> notif: textDocument/didChange: {"textDocument":{"uri":"file:///Users/vincent/junk/2018/08/26-143921.go","version":5},"contentChanges":[{"range":{"start":{"line":7,"character":2},"end":{"line":7,"character":2}},"rangeLength":0,"text":"m"}]}
--> request #6: textDocument/hover: {"textDocument":{"uri":"file:///Users/vincent/junk/2018/08/26-143921.go"},"position":{"line":7,"character":3}}
parseLocalPackage error: no more package files found
<-- error #6: textDocument/hover: {"code":0,"message":"no declaration found for fm","data":null}
--> notif: textDocument/didChange: {"textDocument":{"uri":"file:///Users/vincent/junk/2018/08/26-143921.go","version":6},"contentChanges":[{"range":{"start":{"line":7,"character":3},"end":{"line":7,"character":3}},"rangeLength":0,"text":"t"}]}
--> request #7: textDocument/hover: {"textDocument":{"uri":"file:///Users/vincent/junk/2018/08/26-143921.go"},"position":{"line":7,"character":4}}
<-- result #7: textDocument/hover: {"contents":[{"language":"go","value":"package fmt (\"fmt\")"},"Package fmt implements formatted I/O with functions analogous to C's printf and scanf.  The format 'verbs' are derived from C's but are simpler. \n\n### hdr-PrintingPrinting\nThe verbs: \n\nGeneral: \n\n```\n%v\tthe value in a default format\n\twhen printing structs, the plus flag (%+v) adds field names\n%#v\ta Go-syntax representation of the value\n%T\ta Go-syntax representation of the type of the value\n%%\ta literal percent sign; consumes no value\n\n```\nBoolean: \n\n```\n%t\tthe word true or false\n\n```\nInteger: \n\n```\n%b\tbase 2\n%c\tthe character represented by the corresponding Unicode code point\n%d\tbase 10\n%o\tbase 8\n%q\ta single-quoted character literal safely escaped with Go syntax.\n%x\tbase 16, with lower-case letters for a-f\n%X\tbase 16, with upper-case letters for A-F\n%U\tUnicode format: U+1234; same as \"U+%04X\"\n\n```\nFloating-point and complex constituents: \n\n```\n%b\tdecimalless scientific notation with exponent a power of two,\n\tin the manner of strconv.FormatFloat with the 'b' format,\n\te.g. -123456p-78\n%e\tscientific notation, e.g. -1.234456e+78\n%E\tscientific notation, e.g. -1.234456E+78\n%f\tdecimal point but no exponent, e.g. 123.456\n%F\tsynonym for %f\n%g\t%e for large exponents, %f otherwise. Precision is discussed below.\n%G\t%E for large exponents, %F otherwise\n\n```\nString and slice of bytes (treated equivalently with these verbs): \n\n```\n%s\tthe uninterpreted bytes of the string or slice\n%q\ta double-quoted string safely escaped with Go syntax\n%x\tbase 16, lower-case, two characters per byte\n%X\tbase 16, upper-case, two characters per byte\n\n```\nSlice: \n\n```\n%p\taddress of 0th element in base 16 notation, with leading 0x\n\n```\nPointer: \n\n```\n%p\tbase 16 notation, with leading 0x\nThe %b, %d, %o, %x and %X verbs also work with pointers,\nformatting the value exactly as if it were an integer.\n\n```\nThe default format for %v is: \n\n```\nbool:                    %t\nint, int8 etc.:          %d\nuint, uint8 etc.:        %d, %#x if printed with %#v\nfloat32, complex64, etc: %g\nstring:                  %s\nchan:                    %p\npointer:                 %p\n\n```\nFor compound objects, the elements are printed using these rules, recursively, laid out like this: \n\n```\nstruct:             {field0 field1 ...}\narray, slice:       [elem0 elem1 ...]\nmaps:               map[key1:value1 key2:value2 ...]\npointer to above:   \u0026{}, \u0026[], \u0026map[]\n\n```\nWidth is specified by an optional decimal number immediately preceding the verb. If absent, the width is whatever is necessary to represent the value. Precision is specified after the (optional) width by a period followed by a decimal number. If no period is present, a default precision is used. A period with no following number specifies a precision of zero. Examples: \n\n```\n%f     default width, default precision\n%9f    width 9, default precision\n%.2f   default width, precision 2\n%9.2f  width 9, precision 2\n%9.f   width 9, precision 0\n\n```\nWidth and precision are measured in units of Unicode code points, that is, runes. (This differs from C's printf where the units are always measured in bytes.) Either or both of the flags may be replaced with the character '*', causing their values to be obtained from the next operand (preceding the one to format), which must be of type int. \n\nFor most values, width is the minimum number of runes to output, padding the formatted form with spaces if necessary. \n\nFor strings, byte slices and byte arrays, however, precision limits the length of the input to be formatted (not the size of the output), truncating if necessary. Normally it is measured in runes, but for these types when formatted with the %x or %X format it is measured in bytes. \n\nFor floating-point values, width sets the minimum width of the field and precision sets the number of places after the decimal, if appropriate, except that for %g/%G precision sets the maximum number of significant digits (trailing zeros are removed). For example, given 12.345 the format %6.3f prints 12.345 while %.3g prints 12.3. The default precision for %e, %f and %#g is 6; for %g it is the smallest number of digits necessary to identify the value uniquely. \n\nFor complex numbers, the width and precision apply to the two components independently and the result is parenthesized, so %f applied to 1.2+3.4i produces (1.200000+3.400000i). \n\nOther flags: \n\n```\n+\talways print a sign for numeric values;\n\tguarantee ASCII-only output for %q (%+q)\n-\tpad with spaces on the right rather than the left (left-justify the field)\n#\talternate format: add leading 0 for octal (%#o), 0x for hex (%#x);\n\t0X for hex (%#X); suppress 0x for %p (%#p);\n\tfor %q, print a raw (backquoted) string if strconv.CanBackquote\n\treturns true;\n\talways print a decimal point for %e, %E, %f, %F, %g and %G;\n\tdo not remove trailing zeros for %g and %G;\n\twrite e.g. U+0078 'x' if the character is printable for %U (%#U).\n' '\t(space) leave a space for elided sign in numbers (% d);\n\tput spaces between bytes printing strings or slices in hex (% x, % X)\n0\tpad with leading zeros rather than spaces;\n\tfor numbers, this moves the padding after the sign\n\n```\nFlags are ignored by verbs that do not expect them. For example there is no alternate decimal format, so %#d and %d behave identically. \n\nFor each Printf-like function, there is also a Print function that takes no format and is equivalent to saying %v for every operand.  Another variant Println inserts blanks between operands and appends a newline. \n\nRegardless of the verb, if an operand is an interface value, the internal concrete value is used, not the interface itself. Thus: \n\n```\nvar i interface{} = 23\nfmt.Printf(\"%v\\n\", i)\n\n```\nwill print 23. \n\nExcept when printed using the verbs %T and %p, special formatting considerations apply for operands that implement certain interfaces. In order of application: \n\n1. If the operand is a reflect.Value, the operand is replaced by the concrete value that it holds, and printing continues with the next rule. \n\n2. If an operand implements the Formatter interface, it will be invoked. Formatter provides fine control of formatting. \n\n3. If the %v verb is used with the # flag (%#v) and the operand implements the GoStringer interface, that will be invoked. \n\nIf the format (which is implicitly %v for Println etc.) is valid for a string (%s %q %v %x %X), the following two rules apply: \n\n4. If an operand implements the error interface, the Error method will be invoked to convert the object to a string, which will then be formatted as required by the verb (if any). \n\n5. If an operand implements method String() string, that method will be invoked to convert the object to a string, which will then be formatted as required by the verb (if any). \n\nFor compound operands such as slices and structs, the format applies to the elements of each operand, recursively, not to the operand as a whole. Thus %q will quote each element of a slice of strings, and %6.2f will control formatting for each element of a floating-point array. \n\nHowever, when printing a byte slice with a string-like verb (%s %q %x %X), it is treated identically to a string, as a single item. \n\nTo avoid recursion in cases such as \n\n```\ntype X string\nfunc (x X) String() string { return Sprintf(\"\u003c%s\u003e\", x) }\n\n```\nconvert the value before recurring: \n\n```\nfunc (x X) String() string { return Sprintf(\"\u003c%s\u003e\", string(x)) }\n\n```\nInfinite recursion can also be triggered by self-referential data structures, such as a slice that contains itself as an element, if that type has a String method. Such pathologies are rare, however, and the package does not protect against them. \n\nWhen printing a struct, fmt cannot and therefore does not invoke formatting methods such as Error or String on unexported fields. \n\nExplicit argument indexes: \n\nIn Printf, Sprintf, and Fprintf, the default behavior is for each formatting verb to format successive arguments passed in the call. However, the notation [n] immediately before the verb indicates that the nth one-indexed argument is to be formatted instead. The same notation before a '*' for a width or precision selects the argument index holding the value. After processing a bracketed expression [n], subsequent verbs will use arguments n+1, n+2, etc. unless otherwise directed. \n\nFor example, \n\n```\nfmt.Sprintf(\"%[2]d %[1]d\\n\", 11, 22)\n\n```\nwill yield \"22 11\", while \n\n```\nfmt.Sprintf(\"%[3]*.[2]*[1]f\", 12.0, 2, 6)\n\n```\nequivalent to \n\n```\nfmt.Sprintf(\"%6.2f\", 12.0)\n\n```\nwill yield \" 12.00\". Because an explicit index affects subsequent verbs, this notation can be used to print the same values multiple times by resetting the index for the first argument to be repeated: \n\n```\nfmt.Sprintf(\"%d %d %#[1]x %#x\", 16, 17)\n\n```\nwill yield \"16 17 0x10 0x11\". \n\nFormat errors: \n\nIf an invalid argument is given for a verb, such as providing a string to %d, the generated string will contain a description of the problem, as in these examples: \n\n```\nWrong type or unknown verb: %!verb(type=value)\n\tPrintf(\"%d\", hi):          %!d(string=hi)\nToo many arguments: %!(EXTRA type=value)\n\tPrintf(\"hi\", \"guys\"):      hi%!(EXTRA string=guys)\nToo few arguments: %!verb(MISSING)\n\tPrintf(\"hi%d\"):            hi%!d(MISSING)\nNon-int for width or precision: %!(BADWIDTH) or %!(BADPREC)\n\tPrintf(\"%*s\", 4.5, \"hi\"):  %!(BADWIDTH)hi\n\tPrintf(\"%.*s\", 4.5, \"hi\"): %!(BADPREC)hi\nInvalid or invalid use of argument index: %!(BADINDEX)\n\tPrintf(\"%*[2]d\", 7):       %!d(BADINDEX)\n\tPrintf(\"%.[2]d\", 7):       %!d(BADINDEX)\n\n```\nAll errors begin with the string \"%!\" followed sometimes by a single character (the verb) and end with a parenthesized description. \n\nIf an Error or String method triggers a panic when called by a print routine, the fmt package reformats the error message from the panic, decorating it with an indication that it came through the fmt package.  For example, if a String method calls panic(\"bad\"), the resulting formatted message will look like \n\n```\n%!s(PANIC=bad)\n\n```\nThe %!s just shows the print verb in use when the failure occurred. If the panic is caused by a nil receiver to an Error or String method, however, the output is the undecorated string, \"\u003cnil\u003e\". \n\n### hdr-ScanningScanning\nAn analogous set of functions scans formatted text to yield values.  Scan, Scanf and Scanln read from os.Stdin; Fscan, Fscanf and Fscanln read from a specified io.Reader; Sscan, Sscanf and Sscanln read from an argument string. \n\nScan, Fscan, Sscan treat newlines in the input as spaces. \n\nScanln, Fscanln and Sscanln stop scanning at a newline and require that the items be followed by a newline or EOF. \n\nScanf, Fscanf, and Sscanf parse the arguments according to a format string, analogous to that of Printf. In the text that follows, 'space' means any Unicode whitespace character except newline. \n\nIn the format string, a verb introduced by the % character consumes and parses input; these verbs are described in more detail below. A character other than %, space, or newline in the format consumes exactly that input character, which must be present. A newline with zero or more spaces before it in the format string consumes zero or more spaces in the input followed by a single newline or the end of the input. A space following a newline in the format string consumes zero or more spaces in the input. Otherwise, any run of one or more spaces in the format string consumes as many spaces as possible in the input. Unless the run of spaces in the format string appears adjacent to a newline, the run must consume at least one space from the input or find the end of the input. \n\nThe handling of spaces and newlines differs from that of C's scanf family: in C, newlines are treated as any other space, and it is never an error when a run of spaces in the format string finds no spaces to consume in the input. \n\nThe verbs behave analogously to those of Printf. For example, %x will scan an integer as a hexadecimal number, and %v will scan the default representation format for the value. The Printf verbs %p and %T and the flags # and + are not implemented. The verbs %e %E %f %F %g and %G are all equivalent and scan any floating-point or complex value. For float and complex literals in scientific notation, both the decimal (e) and binary (p) exponent formats are supported (for example: \"2.3e+7\" and \"4.5p-8\"). \n\nInput processed by verbs is implicitly space-delimited: the implementation of every verb except %c starts by discarding leading spaces from the remaining input, and the %s verb (and %v reading into a string) stops consuming input at the first space or newline character. \n\nThe familiar base-setting prefixes 0 (octal) and 0x (hexadecimal) are accepted when scanning integers without a format or with the %v verb. \n\nWidth is interpreted in the input text but there is no syntax for scanning with a precision (no %5.2f, just %5f). If width is provided, it applies after leading spaces are trimmed and specifies the maximum number of runes to read to satisfy the verb. For example, \n\n```\nSscanf(\" 1234567 \", \"%5s%d\", \u0026s, \u0026i)\n\n```\nwill set s to \"12345\" and i to 67 while \n\n```\nSscanf(\" 12 34 567 \", \"%5s%d\", \u0026s, \u0026i)\n\n```\nwill set s to \"12\" and i to 34. \n\nIn all the scanning functions, a carriage return followed immediately by a newline is treated as a plain newline (\\r\\n means the same as \\n). \n\nIn all the scanning functions, if an operand implements method Scan (that is, it implements the Scanner interface) that method will be used to scan the text for that operand.  Also, if the number of arguments scanned is less than the number of arguments provided, an error is returned. \n\nAll arguments to be scanned must be either pointers to basic types or implementations of the Scanner interface. \n\nLike Scanf and Fscanf, Sscanf need not consume its entire input. There is no way to recover how much of the input string Sscanf used. \n\nNote: Fscan etc. can read one character (rune) past the input they return, which means that a loop calling a scan routine may skip some of the input.  This is usually a problem only when there is no space between input values.  If the reader provided to Fscan implements ReadRune, that method will be used to read characters.  If the reader also implements UnreadRune, that method will be used to save the character and successive calls will not lose data.  To attach ReadRune and UnreadRune methods to a reader without that capability, use bufio.NewReader. \n\n"]}
--> request #8: textDocument/completion: {"textDocument":{"uri":"file:///Users/vincent/junk/2018/08/26-143921.go"},"position":{"line":7,"character":4}}
--> request #9: textDocument/hover: {"textDocument":{"uri":"file:///Users/vincent/junk/2018/08/26-143921.go"},"position":{"line":7,"character":1}}
<-- result #8: textDocument/completion: {"isIncomplete":false,"items":[{"label":"PANIC","detail":"PANIC","insertText":"PANIC","insertTextFormat":1,"textEdit":{"range":{"start":{"line":7,"character":4},"end":{"line":7,"character":4}},"newText":"PANIC"}}]}
<-- result #9: textDocument/hover: {"contents":[{"language":"go","value":"package fmt (\"fmt\")"},"Package fmt implements formatted I/O with functions analogous to C's printf and scanf.  The format 'verbs' are derived from C's but are simpler. \n\n### hdr-PrintingPrinting\nThe verbs: \n\nGeneral: \n\n```\n%v\tthe value in a default format\n\twhen printing structs, the plus flag (%+v) adds field names\n%#v\ta Go-syntax representation of the value\n%T\ta Go-syntax representation of the type of the value\n%%\ta literal percent sign; consumes no value\n\n```\nBoolean: \n\n```\n%t\tthe word true or false\n\n```\nInteger: \n\n```\n%b\tbase 2\n%c\tthe character represented by the corresponding Unicode code point\n%d\tbase 10\n%o\tbase 8\n%q\ta single-quoted character literal safely escaped with Go syntax.\n%x\tbase 16, with lower-case letters for a-f\n%X\tbase 16, with upper-case letters for A-F\n%U\tUnicode format: U+1234; same as \"U+%04X\"\n\n```\nFloating-point and complex constituents: \n\n```\n%b\tdecimalless scientific notation with exponent a power of two,\n\tin the manner of strconv.FormatFloat with the 'b' format,\n\te.g. -123456p-78\n%e\tscientific notation, e.g. -1.234456e+78\n%E\tscientific notation, e.g. -1.234456E+78\n%f\tdecimal point but no exponent, e.g. 123.456\n%F\tsynonym for %f\n%g\t%e for large exponents, %f otherwise. Precision is discussed below.\n%G\t%E for large exponents, %F otherwise\n\n```\nString and slice of bytes (treated equivalently with these verbs): \n\n```\n%s\tthe uninterpreted bytes of the string or slice\n%q\ta double-quoted string safely escaped with Go syntax\n%x\tbase 16, lower-case, two characters per byte\n%X\tbase 16, upper-case, two characters per byte\n\n```\nSlice: \n\n```\n%p\taddress of 0th element in base 16 notation, with leading 0x\n\n```\nPointer: \n\n```\n%p\tbase 16 notation, with leading 0x\nThe %b, %d, %o, %x and %X verbs also work with pointers,\nformatting the value exactly as if it were an integer.\n\n```\nThe default format for %v is: \n\n```\nbool:                    %t\nint, int8 etc.:          %d\nuint, uint8 etc.:        %d, %#x if printed with %#v\nfloat32, complex64, etc: %g\nstring:                  %s\nchan:                    %p\npointer:                 %p\n\n```\nFor compound objects, the elements are printed using these rules, recursively, laid out like this: \n\n```\nstruct:             {field0 field1 ...}\narray, slice:       [elem0 elem1 ...]\nmaps:               map[key1:value1 key2:value2 ...]\npointer to above:   \u0026{}, \u0026[], \u0026map[]\n\n```\nWidth is specified by an optional decimal number immediately preceding the verb. If absent, the width is whatever is necessary to represent the value. Precision is specified after the (optional) width by a period followed by a decimal number. If no period is present, a default precision is used. A period with no following number specifies a precision of zero. Examples: \n\n```\n%f     default width, default precision\n%9f    width 9, default precision\n%.2f   default width, precision 2\n%9.2f  width 9, precision 2\n%9.f   width 9, precision 0\n\n```\nWidth and precision are measured in units of Unicode code points, that is, runes. (This differs from C's printf where the units are always measured in bytes.) Either or both of the flags may be replaced with the character '*', causing their values to be obtained from the next operand (preceding the one to format), which must be of type int. \n\nFor most values, width is the minimum number of runes to output, padding the formatted form with spaces if necessary. \n\nFor strings, byte slices and byte arrays, however, precision limits the length of the input to be formatted (not the size of the output), truncating if necessary. Normally it is measured in runes, but for these types when formatted with the %x or %X format it is measured in bytes. \n\nFor floating-point values, width sets the minimum width of the field and precision sets the number of places after the decimal, if appropriate, except that for %g/%G precision sets the maximum number of significant digits (trailing zeros are removed). For example, given 12.345 the format %6.3f prints 12.345 while %.3g prints 12.3. The default precision for %e, %f and %#g is 6; for %g it is the smallest number of digits necessary to identify the value uniquely. \n\nFor complex numbers, the width and precision apply to the two components independently and the result is parenthesized, so %f applied to 1.2+3.4i produces (1.200000+3.400000i). \n\nOther flags: \n\n```\n+\talways print a sign for numeric values;\n\tguarantee ASCII-only output for %q (%+q)\n-\tpad with spaces on the right rather than the left (left-justify the field)\n#\talternate format: add leading 0 for octal (%#o), 0x for hex (%#x);\n\t0X for hex (%#X); suppress 0x for %p (%#p);\n\tfor %q, print a raw (backquoted) string if strconv.CanBackquote\n\treturns true;\n\talways print a decimal point for %e, %E, %f, %F, %g and %G;\n\tdo not remove trailing zeros for %g and %G;\n\twrite e.g. U+0078 'x' if the character is printable for %U (%#U).\n' '\t(space) leave a space for elided sign in numbers (% d);\n\tput spaces between bytes printing strings or slices in hex (% x, % X)\n0\tpad with leading zeros rather than spaces;\n\tfor numbers, this moves the padding after the sign\n\n```\nFlags are ignored by verbs that do not expect them. For example there is no alternate decimal format, so %#d and %d behave identically. \n\nFor each Printf-like function, there is also a Print function that takes no format and is equivalent to saying %v for every operand.  Another variant Println inserts blanks between operands and appends a newline. \n\nRegardless of the verb, if an operand is an interface value, the internal concrete value is used, not the interface itself. Thus: \n\n```\nvar i interface{} = 23\nfmt.Printf(\"%v\\n\", i)\n\n```\nwill print 23. \n\nExcept when printed using the verbs %T and %p, special formatting considerations apply for operands that implement certain interfaces. In order of application: \n\n1. If the operand is a reflect.Value, the operand is replaced by the concrete value that it holds, and printing continues with the next rule. \n\n2. If an operand implements the Formatter interface, it will be invoked. Formatter provides fine control of formatting. \n\n3. If the %v verb is used with the # flag (%#v) and the operand implements the GoStringer interface, that will be invoked. \n\nIf the format (which is implicitly %v for Println etc.) is valid for a string (%s %q %v %x %X), the following two rules apply: \n\n4. If an operand implements the error interface, the Error method will be invoked to convert the object to a string, which will then be formatted as required by the verb (if any). \n\n5. If an operand implements method String() string, that method will be invoked to convert the object to a string, which will then be formatted as required by the verb (if any). \n\nFor compound operands such as slices and structs, the format applies to the elements of each operand, recursively, not to the operand as a whole. Thus %q will quote each element of a slice of strings, and %6.2f will control formatting for each element of a floating-point array. \n\nHowever, when printing a byte slice with a string-like verb (%s %q %x %X), it is treated identically to a string, as a single item. \n\nTo avoid recursion in cases such as \n\n```\ntype X string\nfunc (x X) String() string { return Sprintf(\"\u003c%s\u003e\", x) }\n\n```\nconvert the value before recurring: \n\n```\nfunc (x X) String() string { return Sprintf(\"\u003c%s\u003e\", string(x)) }\n\n```\nInfinite recursion can also be triggered by self-referential data structures, such as a slice that contains itself as an element, if that type has a String method. Such pathologies are rare, however, and the package does not protect against them. \n\nWhen printing a struct, fmt cannot and therefore does not invoke formatting methods such as Error or String on unexported fields. \n\nExplicit argument indexes: \n\nIn Printf, Sprintf, and Fprintf, the default behavior is for each formatting verb to format successive arguments passed in the call. However, the notation [n] immediately before the verb indicates that the nth one-indexed argument is to be formatted instead. The same notation before a '*' for a width or precision selects the argument index holding the value. After processing a bracketed expression [n], subsequent verbs will use arguments n+1, n+2, etc. unless otherwise directed. \n\nFor example, \n\n```\nfmt.Sprintf(\"%[2]d %[1]d\\n\", 11, 22)\n\n```\nwill yield \"22 11\", while \n\n```\nfmt.Sprintf(\"%[3]*.[2]*[1]f\", 12.0, 2, 6)\n\n```\nequivalent to \n\n```\nfmt.Sprintf(\"%6.2f\", 12.0)\n\n```\nwill yield \" 12.00\". Because an explicit index affects subsequent verbs, this notation can be used to print the same values multiple times by resetting the index for the first argument to be repeated: \n\n```\nfmt.Sprintf(\"%d %d %#[1]x %#x\", 16, 17)\n\n```\nwill yield \"16 17 0x10 0x11\". \n\nFormat errors: \n\nIf an invalid argument is given for a verb, such as providing a string to %d, the generated string will contain a description of the problem, as in these examples: \n\n```\nWrong type or unknown verb: %!verb(type=value)\n\tPrintf(\"%d\", hi):          %!d(string=hi)\nToo many arguments: %!(EXTRA type=value)\n\tPrintf(\"hi\", \"guys\"):      hi%!(EXTRA string=guys)\nToo few arguments: %!verb(MISSING)\n\tPrintf(\"hi%d\"):            hi%!d(MISSING)\nNon-int for width or precision: %!(BADWIDTH) or %!(BADPREC)\n\tPrintf(\"%*s\", 4.5, \"hi\"):  %!(BADWIDTH)hi\n\tPrintf(\"%.*s\", 4.5, \"hi\"): %!(BADPREC)hi\nInvalid or invalid use of argument index: %!(BADINDEX)\n\tPrintf(\"%*[2]d\", 7):       %!d(BADINDEX)\n\tPrintf(\"%.[2]d\", 7):       %!d(BADINDEX)\n\n```\nAll errors begin with the string \"%!\" followed sometimes by a single character (the verb) and end with a parenthesized description. \n\nIf an Error or String method triggers a panic when called by a print routine, the fmt package reformats the error message from the panic, decorating it with an indication that it came through the fmt package.  For example, if a String method calls panic(\"bad\"), the resulting formatted message will look like \n\n```\n%!s(PANIC=bad)\n\n```\nThe %!s just shows the print verb in use when the failure occurred. If the panic is caused by a nil receiver to an Error or String method, however, the output is the undecorated string, \"\u003cnil\u003e\". \n\n### hdr-ScanningScanning\nAn analogous set of functions scans formatted text to yield values.  Scan, Scanf and Scanln read from os.Stdin; Fscan, Fscanf and Fscanln read from a specified io.Reader; Sscan, Sscanf and Sscanln read from an argument string. \n\nScan, Fscan, Sscan treat newlines in the input as spaces. \n\nScanln, Fscanln and Sscanln stop scanning at a newline and require that the items be followed by a newline or EOF. \n\nScanf, Fscanf, and Sscanf parse the arguments according to a format string, analogous to that of Printf. In the text that follows, 'space' means any Unicode whitespace character except newline. \n\nIn the format string, a verb introduced by the % character consumes and parses input; these verbs are described in more detail below. A character other than %, space, or newline in the format consumes exactly that input character, which must be present. A newline with zero or more spaces before it in the format string consumes zero or more spaces in the input followed by a single newline or the end of the input. A space following a newline in the format string consumes zero or more spaces in the input. Otherwise, any run of one or more spaces in the format string consumes as many spaces as possible in the input. Unless the run of spaces in the format string appears adjacent to a newline, the run must consume at least one space from the input or find the end of the input. \n\nThe handling of spaces and newlines differs from that of C's scanf family: in C, newlines are treated as any other space, and it is never an error when a run of spaces in the format string finds no spaces to consume in the input. \n\nThe verbs behave analogously to those of Printf. For example, %x will scan an integer as a hexadecimal number, and %v will scan the default representation format for the value. The Printf verbs %p and %T and the flags # and + are not implemented. The verbs %e %E %f %F %g and %G are all equivalent and scan any floating-point or complex value. For float and complex literals in scientific notation, both the decimal (e) and binary (p) exponent formats are supported (for example: \"2.3e+7\" and \"4.5p-8\"). \n\nInput processed by verbs is implicitly space-delimited: the implementation of every verb except %c starts by discarding leading spaces from the remaining input, and the %s verb (and %v reading into a string) stops consuming input at the first space or newline character. \n\nThe familiar base-setting prefixes 0 (octal) and 0x (hexadecimal) are accepted when scanning integers without a format or with the %v verb. \n\nWidth is interpreted in the input text but there is no syntax for scanning with a precision (no %5.2f, just %5f). If width is provided, it applies after leading spaces are trimmed and specifies the maximum number of runes to read to satisfy the verb. For example, \n\n```\nSscanf(\" 1234567 \", \"%5s%d\", \u0026s, \u0026i)\n\n```\nwill set s to \"12345\" and i to 67 while \n\n```\nSscanf(\" 12 34 567 \", \"%5s%d\", \u0026s, \u0026i)\n\n```\nwill set s to \"12\" and i to 34. \n\nIn all the scanning functions, a carriage return followed immediately by a newline is treated as a plain newline (\\r\\n means the same as \\n). \n\nIn all the scanning functions, if an operand implements method Scan (that is, it implements the Scanner interface) that method will be used to scan the text for that operand.  Also, if the number of arguments scanned is less than the number of arguments provided, an error is returned. \n\nAll arguments to be scanned must be either pointers to basic types or implementations of the Scanner interface. \n\nLike Scanf and Fscanf, Sscanf need not consume its entire input. There is no way to recover how much of the input string Sscanf used. \n\nNote: Fscan etc. can read one character (rune) past the input they return, which means that a loop calling a scan routine may skip some of the input.  This is usually a problem only when there is no space between input values.  If the reader provided to Fscan implements ReadRune, that method will be used to read characters.  If the reader also implements UnreadRune, that method will be used to save the character and successive calls will not lose data.  To attach ReadRune and UnreadRune methods to a reader without that capability, use bufio.NewReader. \n\n"]}
--> request #10: textDocument/hover: {"textDocument":{"uri":"file:///Users/vincent/junk/2018/08/26-143921.go"},"position":{"line":7,"character":4}}
<-- result #10: textDocument/hover: {"contents":[{"language":"go","value":"package fmt (\"fmt\")"},"Package fmt implements formatted I/O with functions analogous to C's printf and scanf.  The format 'verbs' are derived from C's but are simpler. \n\n### hdr-PrintingPrinting\nThe verbs: \n\nGeneral: \n\n```\n%v\tthe value in a default format\n\twhen printing structs, the plus flag (%+v) adds field names\n%#v\ta Go-syntax representation of the value\n%T\ta Go-syntax representation of the type of the value\n%%\ta literal percent sign; consumes no value\n\n```\nBoolean: \n\n```\n%t\tthe word true or false\n\n```\nInteger: \n\n```\n%b\tbase 2\n%c\tthe character represented by the corresponding Unicode code point\n%d\tbase 10\n%o\tbase 8\n%q\ta single-quoted character literal safely escaped with Go syntax.\n%x\tbase 16, with lower-case letters for a-f\n%X\tbase 16, with upper-case letters for A-F\n%U\tUnicode format: U+1234; same as \"U+%04X\"\n\n```\nFloating-point and complex constituents: \n\n```\n%b\tdecimalless scientific notation with exponent a power of two,\n\tin the manner of strconv.FormatFloat with the 'b' format,\n\te.g. -123456p-78\n%e\tscientific notation, e.g. -1.234456e+78\n%E\tscientific notation, e.g. -1.234456E+78\n%f\tdecimal point but no exponent, e.g. 123.456\n%F\tsynonym for %f\n%g\t%e for large exponents, %f otherwise. Precision is discussed below.\n%G\t%E for large exponents, %F otherwise\n\n```\nString and slice of bytes (treated equivalently with these verbs): \n\n```\n%s\tthe uninterpreted bytes of the string or slice\n%q\ta double-quoted string safely escaped with Go syntax\n%x\tbase 16, lower-case, two characters per byte\n%X\tbase 16, upper-case, two characters per byte\n\n```\nSlice: \n\n```\n%p\taddress of 0th element in base 16 notation, with leading 0x\n\n```\nPointer: \n\n```\n%p\tbase 16 notation, with leading 0x\nThe %b, %d, %o, %x and %X verbs also work with pointers,\nformatting the value exactly as if it were an integer.\n\n```\nThe default format for %v is: \n\n```\nbool:                    %t\nint, int8 etc.:          %d\nuint, uint8 etc.:        %d, %#x if printed with %#v\nfloat32, complex64, etc: %g\nstring:                  %s\nchan:                    %p\npointer:                 %p\n\n```\nFor compound objects, the elements are printed using these rules, recursively, laid out like this: \n\n```\nstruct:             {field0 field1 ...}\narray, slice:       [elem0 elem1 ...]\nmaps:               map[key1:value1 key2:value2 ...]\npointer to above:   \u0026{}, \u0026[], \u0026map[]\n\n```\nWidth is specified by an optional decimal number immediately preceding the verb. If absent, the width is whatever is necessary to represent the value. Precision is specified after the (optional) width by a period followed by a decimal number. If no period is present, a default precision is used. A period with no following number specifies a precision of zero. Examples: \n\n```\n%f     default width, default precision\n%9f    width 9, default precision\n%.2f   default width, precision 2\n%9.2f  width 9, precision 2\n%9.f   width 9, precision 0\n\n```\nWidth and precision are measured in units of Unicode code points, that is, runes. (This differs from C's printf where the units are always measured in bytes.) Either or both of the flags may be replaced with the character '*', causing their values to be obtained from the next operand (preceding the one to format), which must be of type int. \n\nFor most values, width is the minimum number of runes to output, padding the formatted form with spaces if necessary. \n\nFor strings, byte slices and byte arrays, however, precision limits the length of the input to be formatted (not the size of the output), truncating if necessary. Normally it is measured in runes, but for these types when formatted with the %x or %X format it is measured in bytes. \n\nFor floating-point values, width sets the minimum width of the field and precision sets the number of places after the decimal, if appropriate, except that for %g/%G precision sets the maximum number of significant digits (trailing zeros are removed). For example, given 12.345 the format %6.3f prints 12.345 while %.3g prints 12.3. The default precision for %e, %f and %#g is 6; for %g it is the smallest number of digits necessary to identify the value uniquely. \n\nFor complex numbers, the width and precision apply to the two components independently and the result is parenthesized, so %f applied to 1.2+3.4i produces (1.200000+3.400000i). \n\nOther flags: \n\n```\n+\talways print a sign for numeric values;\n\tguarantee ASCII-only output for %q (%+q)\n-\tpad with spaces on the right rather than the left (left-justify the field)\n#\talternate format: add leading 0 for octal (%#o), 0x for hex (%#x);\n\t0X for hex (%#X); suppress 0x for %p (%#p);\n\tfor %q, print a raw (backquoted) string if strconv.CanBackquote\n\treturns true;\n\talways print a decimal point for %e, %E, %f, %F, %g and %G;\n\tdo not remove trailing zeros for %g and %G;\n\twrite e.g. U+0078 'x' if the character is printable for %U (%#U).\n' '\t(space) leave a space for elided sign in numbers (% d);\n\tput spaces between bytes printing strings or slices in hex (% x, % X)\n0\tpad with leading zeros rather than spaces;\n\tfor numbers, this moves the padding after the sign\n\n```\nFlags are ignored by verbs that do not expect them. For example there is no alternate decimal format, so %#d and %d behave identically. \n\nFor each Printf-like function, there is also a Print function that takes no format and is equivalent to saying %v for every operand.  Another variant Println inserts blanks between operands and appends a newline. \n\nRegardless of the verb, if an operand is an interface value, the internal concrete value is used, not the interface itself. Thus: \n\n```\nvar i interface{} = 23\nfmt.Printf(\"%v\\n\", i)\n\n```\nwill print 23. \n\nExcept when printed using the verbs %T and %p, special formatting considerations apply for operands that implement certain interfaces. In order of application: \n\n1. If the operand is a reflect.Value, the operand is replaced by the concrete value that it holds, and printing continues with the next rule. \n\n2. If an operand implements the Formatter interface, it will be invoked. Formatter provides fine control of formatting. \n\n3. If the %v verb is used with the # flag (%#v) and the operand implements the GoStringer interface, that will be invoked. \n\nIf the format (which is implicitly %v for Println etc.) is valid for a string (%s %q %v %x %X), the following two rules apply: \n\n4. If an operand implements the error interface, the Error method will be invoked to convert the object to a string, which will then be formatted as required by the verb (if any). \n\n5. If an operand implements method String() string, that method will be invoked to convert the object to a string, which will then be formatted as required by the verb (if any). \n\nFor compound operands such as slices and structs, the format applies to the elements of each operand, recursively, not to the operand as a whole. Thus %q will quote each element of a slice of strings, and %6.2f will control formatting for each element of a floating-point array. \n\nHowever, when printing a byte slice with a string-like verb (%s %q %x %X), it is treated identically to a string, as a single item. \n\nTo avoid recursion in cases such as \n\n```\ntype X string\nfunc (x X) String() string { return Sprintf(\"\u003c%s\u003e\", x) }\n\n```\nconvert the value before recurring: \n\n```\nfunc (x X) String() string { return Sprintf(\"\u003c%s\u003e\", string(x)) }\n\n```\nInfinite recursion can also be triggered by self-referential data structures, such as a slice that contains itself as an element, if that type has a String method. Such pathologies are rare, however, and the package does not protect against them. \n\nWhen printing a struct, fmt cannot and therefore does not invoke formatting methods such as Error or String on unexported fields. \n\nExplicit argument indexes: \n\nIn Printf, Sprintf, and Fprintf, the default behavior is for each formatting verb to format successive arguments passed in the call. However, the notation [n] immediately before the verb indicates that the nth one-indexed argument is to be formatted instead. The same notation before a '*' for a width or precision selects the argument index holding the value. After processing a bracketed expression [n], subsequent verbs will use arguments n+1, n+2, etc. unless otherwise directed. \n\nFor example, \n\n```\nfmt.Sprintf(\"%[2]d %[1]d\\n\", 11, 22)\n\n```\nwill yield \"22 11\", while \n\n```\nfmt.Sprintf(\"%[3]*.[2]*[1]f\", 12.0, 2, 6)\n\n```\nequivalent to \n\n```\nfmt.Sprintf(\"%6.2f\", 12.0)\n\n```\nwill yield \" 12.00\". Because an explicit index affects subsequent verbs, this notation can be used to print the same values multiple times by resetting the index for the first argument to be repeated: \n\n```\nfmt.Sprintf(\"%d %d %#[1]x %#x\", 16, 17)\n\n```\nwill yield \"16 17 0x10 0x11\". \n\nFormat errors: \n\nIf an invalid argument is given for a verb, such as providing a string to %d, the generated string will contain a description of the problem, as in these examples: \n\n```\nWrong type or unknown verb: %!verb(type=value)\n\tPrintf(\"%d\", hi):          %!d(string=hi)\nToo many arguments: %!(EXTRA type=value)\n\tPrintf(\"hi\", \"guys\"):      hi%!(EXTRA string=guys)\nToo few arguments: %!verb(MISSING)\n\tPrintf(\"hi%d\"):            hi%!d(MISSING)\nNon-int for width or precision: %!(BADWIDTH) or %!(BADPREC)\n\tPrintf(\"%*s\", 4.5, \"hi\"):  %!(BADWIDTH)hi\n\tPrintf(\"%.*s\", 4.5, \"hi\"): %!(BADPREC)hi\nInvalid or invalid use of argument index: %!(BADINDEX)\n\tPrintf(\"%*[2]d\", 7):       %!d(BADINDEX)\n\tPrintf(\"%.[2]d\", 7):       %!d(BADINDEX)\n\n```\nAll errors begin with the string \"%!\" followed sometimes by a single character (the verb) and end with a parenthesized description. \n\nIf an Error or String method triggers a panic when called by a print routine, the fmt package reformats the error message from the panic, decorating it with an indication that it came through the fmt package.  For example, if a String method calls panic(\"bad\"), the resulting formatted message will look like \n\n```\n%!s(PANIC=bad)\n\n```\nThe %!s just shows the print verb in use when the failure occurred. If the panic is caused by a nil receiver to an Error or String method, however, the output is the undecorated string, \"\u003cnil\u003e\". \n\n### hdr-ScanningScanning\nAn analogous set of functions scans formatted text to yield values.  Scan, Scanf and Scanln read from os.Stdin; Fscan, Fscanf and Fscanln read from a specified io.Reader; Sscan, Sscanf and Sscanln read from an argument string. \n\nScan, Fscan, Sscan treat newlines in the input as spaces. \n\nScanln, Fscanln and Sscanln stop scanning at a newline and require that the items be followed by a newline or EOF. \n\nScanf, Fscanf, and Sscanf parse the arguments according to a format string, analogous to that of Printf. In the text that follows, 'space' means any Unicode whitespace character except newline. \n\nIn the format string, a verb introduced by the % character consumes and parses input; these verbs are described in more detail below. A character other than %, space, or newline in the format consumes exactly that input character, which must be present. A newline with zero or more spaces before it in the format string consumes zero or more spaces in the input followed by a single newline or the end of the input. A space following a newline in the format string consumes zero or more spaces in the input. Otherwise, any run of one or more spaces in the format string consumes as many spaces as possible in the input. Unless the run of spaces in the format string appears adjacent to a newline, the run must consume at least one space from the input or find the end of the input. \n\nThe handling of spaces and newlines differs from that of C's scanf family: in C, newlines are treated as any other space, and it is never an error when a run of spaces in the format string finds no spaces to consume in the input. \n\nThe verbs behave analogously to those of Printf. For example, %x will scan an integer as a hexadecimal number, and %v will scan the default representation format for the value. The Printf verbs %p and %T and the flags # and + are not implemented. The verbs %e %E %f %F %g and %G are all equivalent and scan any floating-point or complex value. For float and complex literals in scientific notation, both the decimal (e) and binary (p) exponent formats are supported (for example: \"2.3e+7\" and \"4.5p-8\"). \n\nInput processed by verbs is implicitly space-delimited: the implementation of every verb except %c starts by discarding leading spaces from the remaining input, and the %s verb (and %v reading into a string) stops consuming input at the first space or newline character. \n\nThe familiar base-setting prefixes 0 (octal) and 0x (hexadecimal) are accepted when scanning integers without a format or with the %v verb. \n\nWidth is interpreted in the input text but there is no syntax for scanning with a precision (no %5.2f, just %5f). If width is provided, it applies after leading spaces are trimmed and specifies the maximum number of runes to read to satisfy the verb. For example, \n\n```\nSscanf(\" 1234567 \", \"%5s%d\", \u0026s, \u0026i)\n\n```\nwill set s to \"12345\" and i to 67 while \n\n```\nSscanf(\" 12 34 567 \", \"%5s%d\", \u0026s, \u0026i)\n\n```\nwill set s to \"12\" and i to 34. \n\nIn all the scanning functions, a carriage return followed immediately by a newline is treated as a plain newline (\\r\\n means the same as \\n). \n\nIn all the scanning functions, if an operand implements method Scan (that is, it implements the Scanner interface) that method will be used to scan the text for that operand.  Also, if the number of arguments scanned is less than the number of arguments provided, an error is returned. \n\nAll arguments to be scanned must be either pointers to basic types or implementations of the Scanner interface. \n\nLike Scanf and Fscanf, Sscanf need not consume its entire input. There is no way to recover how much of the input string Sscanf used. \n\nNote: Fscan etc. can read one character (rune) past the input they return, which means that a loop calling a scan routine may skip some of the input.  This is usually a problem only when there is no space between input values.  If the reader provided to Fscan implements ReadRune, that method will be used to read characters.  If the reader also implements UnreadRune, that method will be used to save the character and successive calls will not lose data.  To attach ReadRune and UnreadRune methods to a reader without that capability, use bufio.NewReader. \n\n"]}
Jackson-soft commented 6 years ago

same issues

seagle0128 commented 6 years ago

I noticed gocode panic in Go 1.11. Not sure if ti's a clue.

chemzqm commented 6 years ago

same issue.