res2go

command module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: May 11, 2021 License: MIT Imports: 9 Imported by: 0

README

Coverage Status

Resource Package Generator for Golang

Very simple generator used to embed some file into executable. Useful to store template files.

go get github.com/Axili39/res2go
go build
go install

usage:

Usage of ./res2go:
  -o string
        output file (default "resources.go")
  -package string
        package name (default "resources")
  -prefix string
        add prefix to all exported function

examples:
res2go ./resources

res2go ./templates/index.html ./templates/style.js

res2go -package myresources index.html

res2go -package myresources -o rsrc/rsrc.go resources/*.templates

res2go -package main -o rsrc.go -prefix Rsrc resources/*

Example in Go code:

//go:generate res2go -package resources -o resources/resources.go resources/*.templates

import (
  "./resources"
)

func main() {
  resources.Init()

  myfile = resources.Files["resources/example.template"]
  fmt.Println(string(myfile))

}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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