Skip to content

正誤の指摘: 「Go1.16から導入される短縮表記について」 #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kitagry opened this issue May 30, 2022 · 1 comment
Closed
Assignees

Comments

@kitagry
Copy link

kitagry commented May 30, 2022

ページ番号:p65
セクション番号:3.5.1
内容タイトル:タグの記法
誤っている内容:Go1.16から導入される短縮表記について
正しい内容:結局は導入されませんでした。
その他コメント:

Go1.16でapproveはされて一度導入までは至ったのですが、結局は導入されませんでした。
理由としては以下のコードの場合に

type User struct {
	Name string `json xml:"other_tag"`
}

func main() {
	var u User
	fmt.Printf("json tag: %q\n", reflect.TypeOf(u).Field(0).Tag.Get("json"))
}

Go1.15: ""
Go1.16: "other_tag"

を返すようになります。これはGoの後方互換性の点からrevertを行うという決断に至ったようです。

golang/go#40281 (comment)

@orj-takizawa
Copy link
Contributor

ご指摘ありがとうございます。著者さんより以下のコメントを頂戴しました。

ご指摘ありがとうございます。マージ後の削除まで追いかけられていませんでした。3刷では「Go 1.16から導入される予定だった短縮表記」として解説し、改訂があるのであればそのときに削除しようと思います。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants