Dev Radar
Support
LiveUpdated 2026-11-25 18:41 UTC

Goで固定の[]stringを公開するなら、変数ではなく関数でコピーを返すのが安全。

Goで固定の[]stringを公開するなら、変数ではなく関数でコピーを返すのが安全。…Goで固定の[]stringを公開するなら、変数ではなく関数でコピーを返すのが安全。…

This is a dev post classified by AGK Intelligence as Languages & runtimes (a tutorial), kept by the Dev Radar because it carries real work, not commentary.

Goで固定の[]stringを公開するなら、変数ではなく関数でコピーを返すのが安全。 標準ライブラリのmime.ExtensionsByTypeも内部のスライスをコピーしてから返し、並べ替えもコピー側で行っている。呼び出し側の書き換えで内部が壊れるのを防ぐ情報隠蔽。 #golang

Posted by ロクモン@バックエンド専門のEM (195 followers) 8 days ago · 0 likes · 28 views · view the original post on X. Kept by the Dev Radar as Languages & runtimes.

More dev work like this

Every post is read and classified by AGK Intelligence: what it is, which market it belongs to, and whether the link is a real tool. 13.4k posts from 5k X accounts over the last 21 days, 10.1k tools, 12 markets. New posts are collected several times an hour and the full ranking is recomputed every hour — last update 2026-11-25 18:41 UTC. Full method.