\documentclass{article}
\usepackage[writeglslabels]{glossaries}

\newglossaryentry{test}{name={test},description={sample}}

\begin{document}
\gls{test}.
\end{document}
