Skip to content

gopowersupply/template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub Go version Build Status Go Report Card Coverage Status code-coverage GoDoc GitHub tag (latest SemVer) GitHub last commit GitHub issues

The repo is template for other projects.

Here long repo description.

Get it from github:

go get -u https://github.com/gopowersupply/template

Documentation can be found here

Examples

This is examples section:

    res, err := shell.Cmd("echo hi")
    panic(err)
    // res: hi    

⚠️ Be aware that command result string truncates. This means that if the real output is ' sample output\n' you will get 'sample output'

Errors handling

    func ExecUnexpected() error {
    	// [...] Here your other returns with own errors
        _, err := shell.Cmd("unexpected_command")
        if err != nil {
        	return err
        }
        // [...] Here your other returns with own errors
    }

    func main() {
    	err := ExecUnexpected()    	
    	if shell.IsCommandError(err) {
    		// [...] to do anything
    	} else {
    		// [...] to do something other    		
    	}
    }

And you can use errors.As(err, &shell.CommandError{}) as alternative.

About

The golang template repo with common badges, .travis-ci, makefile and readme.md template

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published