質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
terminal

Terminalは、Apple社のmacOSに標準で付属しているUNIX端末エミュレータ。UNIXコマンドによってMacの操作および設定を行うことができます。

Go

Go(golang)は、Googleで開発されたオープンソースのプログラミング言語です。

Q&A

1回答

1277閲覧

godoc のインストールができません。

shinei-1

総合スコア0

terminal

Terminalは、Apple社のmacOSに標準で付属しているUNIX端末エミュレータ。UNIXコマンドによってMacの操作および設定を行うことができます。

Go

Go(golang)は、Googleで開発されたオープンソースのプログラミング言語です。

0グッド

1クリップ

投稿2021/07/04 11:56

編集2021/07/05 05:34

前提・実現したいこと

プログラミング初心者です。
現在Go言語の環境設定中なのですが、
goのインストールは完了したのですが、godocがインストールされておりません。
goのversionはgo1.16.5です。
イメージ説明説明](52412dd373fdd5d64b1b723294caイメージ説明36dd.png)

発生している問題・エラーメッセージ

ターミナルで作業しておりますが、
command not found:godoc

該当のソースコード

試したこと

補足情報(FW/ツールのバージョンなど)

go doc でうまくいくという話もお聞きし、追加で写真添付したようにgo doc で見てみますと、とても長いテキストが返ってきました。こちらをコピペしてグーグルで調べても該当するものはなく
不安です。
後半にerrorの記述がとても多いのですが、このようになっていても大丈夫でしょうか。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

goodocgoコマンドに含まれる様になり、go docで使えます!

投稿2021/07/05 05:08

nobonobo

総合スコア3367

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

shinei-1

2021/07/05 05:29

nobonoboさん ご返信くださりありがとうございます! go doc でterminalに打ち込んだところ will 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: fmt.Sprintf("%d %d %#[1]x %#x", 16, 17) will yield "16 17 0x10 0x11". Format errors: If 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: Wrong type or unknown verb: %!verb(type=value) Printf("%d", "hi"): %!d(string=hi) Too many arguments: %!(EXTRA type=value) Printf("hi", "guys"): hi%!(EXTRA string=guys) Too few arguments: %!verb(MISSING) Printf("hi%d"): hi%!d(MISSING) Non-int for width or precision: %!(BADWIDTH) or %!(BADPREC) Printf("%*s", 4.5, "hi"): %!(BADWIDTH)hi Printf("%.*s", 4.5, "hi"): %!(BADPREC)hi Invalid or invalid use of argument index: %!(BADINDEX) Printf("%*[2]d", 7): %!d(BADINDEX) Printf("%.[2]d", 7): %!d(BADINDEX) All errors begin with the string "%!" followed sometimes by a single character (the verb) and end with a parenthesized description. If 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 %!s(PANIC=bad) The %!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, "<nil>". Scanning An 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. Scan, Fscan, Sscan treat newlines in the input as spaces. Scanln, Fscanln and Sscanln stop scanning at a newline and require that the items be followed by a newline or EOF. Scanf, 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. In 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. The 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. The 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. For floating-point and complex values, all valid formatting verbs (%b %e %E %f %F %g %G %x %X and %v) are equivalent and accept both decimal and hexadecimal notation (for example: "2.3e+7", "0x4.5p-8") and digit-separating underscores (for example: "3.14159_26535_89793"). Input 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. The familiar base-setting prefixes 0b (binary), 0o and 0 (octal), and 0x (hexadecimal) are accepted when scanning integers without a format or with the %v verb, as are digit-separating underscores. Width 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, Sscanf(" 1234567 ", "%5s%d", &s, &i) will set s to "12345" and i to 67 while Sscanf(" 12 34 567 ", "%5s%d", &s, &i) will set s to "12" and i to 34. In 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). In 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. All arguments to be scanned must be either pointers to basic types or implementations of the Scanner interface. Like Scanf and Fscanf, Sscanf need not consume its entire input. There is no way to recover how much of the input string Sscanf used. Note: 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. func Errorf(format string, a ...interface{}) error func Fprint(w io.Writer, a ...interface{}) (n int, err error) func Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) func Fprintln(w io.Writer, a ...interface{}) (n int, err error) func Fscan(r io.Reader, a ...interface{}) (n int, err error) func Fscanf(r io.Reader, format string, a ...interface{}) (n int, err error) func Fscanln(r io.Reader, a ...interface{}) (n int, err error) func Print(a ...interface{}) (n int, err error) func Printf(format string, a ...interface{}) (n int, err error) func Println(a ...interface{}) (n int, err error) func Scan(a ...interface{}) (n int, err error) func Scanf(format string, a ...interface{}) (n int, err error) func Scanln(a ...interface{}) (n int, err error) func Sprint(a ...interface{}) string func Sprintf(format string, a ...interface{}) string func Sprintln(a ...interface{}) string func Sscan(str string, a ...interface{}) (n int, err error) func Sscanf(str string, format string, a ...interface{}) (n int, err error) func Sscanln(str string, a ...interface{}) (n int, err error) type Formatter interface{ ... } type GoStringer interface{ ... } type ScanState interface{ ... } type Scanner interface{ ... } type State interface{ ... } type Stringer interface{ ... } となり、後半にerrorのオンパレードを見ることができるのですが、このようになっても問題はないでしょうか。
d_tutuz

2021/07/06 07:00

問題ないです。 上記は fmt パッケージで go doc とコマンドを売っていると思いますが、正しく go doc が表示されています。 上記に表示されている err error は関数の型を表示しているのであって、エラーではないです。
shinei-1

2021/07/12 11:17

d_tutuz さん ご返信ありがとうございます! とても安心致しました。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問