Update on Gootstrap - Using your own custom templates

Hi guys,

I’ve made some changes to the Gootstrap package and now it can accept custom templates in order to bootstrap a new packages. It works like this:

Lets assume that you have the following example.toml file in your file’s system:

#Creates the directories

name = "utils"
    name = "utils.go"
    template = '''package utils'''
    name = "utils_test.go"
    template = '''package utils

    import "testing"

    func Test(t *testing.T) {


name = "labs"
    name = "labs.go"
    template = '''package labs'''
    name = "labs_test.go"
    template = '''package labs

    import "testing"

    func Test(t *testing.T) {


#Creates files in the root directory

name = "README.md"
template = '''#Readme
some reamde

name = "main.go"
template = '''package main

import "fmt"

func main() {

Passing the FULLPATH of your template file as argument for --template flag on gootstrap, will produce the following result:

$ gootstrap new new_project --template /full/path/of/your/example.toml 
===> Creating package new_project
===> Creating directory new_project
===> Creating directory new_project/utils
===> Creating directory new_project/labs
===> Creating new_project/utils/utils.go file
===> Creating new_project/utils/utils_test.go file
===> Creating new_project/labs/labs.go file
===> Creating new_project/labs/labs_test.go file
===> Creating new_project/README.md file
===> Creating new_project/main.go file
===> Package created! cd new_project to access.

For more info: https://github.com/hgsigner/gootstrap

Let me what you guys think :smile:

1 Like

@hgsigner this is awesome!!!

1 Like

Thanks man! I’ve just added the ability of fetching templates from remote servers :smile:

$ gootstrap new remote_simple --template https://raw.githubusercontent.com/hgsigner/gootstrap/master/examples/simple.toml
===> Creating package remote_simple
===> Fetiching url: https://raw.githubusercontent.com/hgsigner/gootstrap/master/examples/simple.toml
===> Creating directory remote_simple
===> Creating directory remote_simple/utils
===> Creating directory remote_simple/labs
===> Creating remote_simple/utils/utils.go file
===> Creating remote_simple/utils/utils_test.go file
===> Creating remote_simple/labs/labs.go file
===> Creating remote_simple/labs/labs_test.go file
===> Creating remote_simple/.gitignore file
===> Creating remote_simple/README.md file
===> Creating remote_simple/main.go file
===> Package created! cd remote_simple to access.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.