# README
gitinfo
Get git repo metagata (lib) and generate gitinfo.json via go generate (cmd)
This package uses external git
binary for creating a file with git metagata like
{
"version": "v0.12.0-1-g99a5776",
"repository": "[email protected]:pgmig/gitinfo.git",
"modified": "2021-02-08T23:00:47+03:00"
}
This file (named `gitinfo.json by default) used later for
- embedding with filesystems
- showing project metagata
Install
go get github.com/pgmig/gitinfo/...
Usage
Create gitinfo.json
Run go:generate just before embedding:
// Generate gitinfo.json
//go:generate gitinfo ../../html
// Generate resource.go by [parcello](github.com/phogolabs/parcello)
//go:generate parcello -q -r -d ../../html
Read gitinfo.json
Read metadata from .gitinfo.json if it exists, fetch from git otherwise
var gi gitinfo.GitInfo
err = gitinfo.New(log, cfg).Make("cmd/", &gi)
Generate gitinfo.json for single dir
//go:generate gitinfo dir
Generate gitinfo.json files for dir/*/ dirs
Used when dir contains git submodules
//go:generate gitinfo dir/*
License
The MIT License (MIT), see LICENSE.
Copyright (c) 2019-2021 Aleksey Kovrizhkin [email protected]
# Packages
No description provided by the author
# Variables
ErrPathMustBeDir raised if given path is not directory.
ErrPathMustNotBeEmpty raised if given path is empty.
# Interfaces
File is an interface for FileSystem.Open func.
FileSystem holds all of used filesystem access methods.