anatoly techtonik
anatoly techtonik

Reputation: 20539

Access package comment from inside Go program?

Is it possible to get package comment from inside of Go program? The equivalent Python code:

#!/usr/bin/env python
"""
Program v1.0
"""
print(__doc__)

Upvotes: 2

Views: 690

Answers (1)

fuz
fuz

Reputation: 93082

Go is not an interpreted language. The source code representation of a program is not part of a compiled Go program and cannot be generated from a compiled Go program. What you want is not possible without external tools that embed the parts of the source you want into the binary.

Upvotes: 1

Related Questions