Code Monkey home page Code Monkey logo

Release Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. 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/typical-go/typical-go
    
  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/typical-go/typical-go"
BUILD_TOOL="tools/typical-build"
TYPTMP=.typical-tmp
TYPGO=$TYPTMP/bin/typical-go
TYPGO_SRC=github.com/typical-go/typical-go

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/typical-go/typical-go
$ 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

Typical Go's Projects

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.