tg-framework

command module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2023 License: MIT Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Release Go-Workflow Go Report Card codebeat badge BCH compliance codecov

Typical Go

Build Automation Tool For Golang

  • Manage build tasks — alternative for makefile
  • Framework-based Build Tool — no DSL to be learned, write build task in Go
  • Wrapper Script — single script to prepare and run the build-tool
  • Supporting java-like annotation for code generation — alternative for go-generate

Requirements

Typical Go known to work with Go 1.17 and later.

Getting Started

  1. Install typical-go (Optional, only needed to set up new project)

    $ go get -u github.com/kmrtftech/tg-framework
    
  2. Setup new project

    $ typical-go setup -new -go-mod -project-pkg=[PACKAGE_NAME]
    
    • -new generate simple app and typical-build source
    • -go-mod initiate go.mod
    • -project-pkg name of project package
  3. Generate wrapper for existing project

    $ typical-go setup
    
  4. Run the project

    $ typical-go run
    

    Or via wrapper (recommendation)

    $ ./typicalw 
    

Check examples/my-project for what generated new project look like

Wrapper Script

typicalw is a bash script to prepare and run the build-tool.

$ ./typicalw

You can hack the parameters accordingly

PROJECT_PKG="github.com/kmrtftech/tg-framework"
BUILD_TOOL="tools/typical-build"
TYPTMP=.typical-tmp
TYPGO=$TYPTMP/bin/typical-go
TYPGO_SRC=github.com/kmrtftech/tg-framework

Any downloaded or required file will be saved in temporary folder which is located in .typical-tmp in project directory including typical-go itself. Its mean you don't need to install typical-go manually and the project always use designed version.

To update typical-go to new version

$ go get -u github.com/kmrtftech/tg-framework
$ rm -rf .typical-tmp

Project Descriptor

By default, project descriptor is located in tools/typical-build/typical-build.go which contain project detail and task list.

var descriptor = typgo.Descriptor{
   ProjectName:    "application-name",
   ProjectVersion: "1.0.0",

   Environment: typgo.DotEnv(".env"),

   Tasks: []typgo.Tasker{
      // test
      &typgo.GoTest{
         Includes: []string{"internal/*", "pkg/*"},
      },
      // build
      &typgo.GoBuild{},
      // run
      &typgo.RunBinary{
         Before: typgo.TaskNames{"build"},
      },
   },
}

The descriptor file is regular golang file that will be compiled by typical-go, so main function should be defined.

func main() {
	typgo.Start(&descriptor)
}

It is possible to use other custom build-tool framework, check examples/custom-build-tool for example.

Wiki

Check wiki for more documentation

Examples

Typical-Go using itself as build-tool which is an excellent example.

For other examples:

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
app
pkg
tools
typical-build command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL