Skip to content

Transform runtime.Caller into a friendly Github URL

License

Notifications You must be signed in to change notification settings

gwillem/go-whodis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Who Dis?

Generate a friendly Git(hub) repository URL for the current file and line number in your Go code. Useful for logs, templates, cron jobs and such, so people can quickly find out where to edit the application. Uses runtime.Caller() and the main module name to guesstimate a repo URL. Currently supports Github but support for other public git services can be easily added.

Usage

import "github.com/gwillem/go-whodis"

// ...

fmt.Println("Generated by", whodis.URL())
// Generated by https://github.com/gwillem/someapp/blob/HEAD/pkg/pkg.go#L11

About

Transform runtime.Caller into a friendly Github URL

Resources

License

Stars

Watchers

Forks

Languages