Example-go-install - A package aims to demonstrate how libraries / commands should be organized in a go package

Example Go Install

This package aims to demonstrate how libraries / commands should be organized in a go package.

Notes

  1. The name of your repository will be the command that users type into the command line. Since my repository is named example-go-install, when you install it, that's the command you'll call on the command line.

  2. If you're testing this out and installing your application multiple times to debug it, make sure you change your $GOPROXY environment variable to be direct, that will avoid any caching of your projects versions.

    export GOPROXY=direct
  3. If your main.go file needs to make use of any of the libraries in your package, you should import them with the fully qualified URL to the github repository including the sub-directory for the library. See main.go for an example of this.

Structure

mylib
  mylib.go
main.go
Item Description
mylib/ One of many possible libraries that your application has packaged with it.
main.go The main entry point for executing the program.

main.go

The main.go file should have it's package set to package main and it should have a main() function. This is what will be called when your program is executed.

main.go

package main

import (
    // Import the library we need
    "github.com/nathan-fiscaletti/example-go-install/mylib"
)

func main() {
    mylib.PrintName("nathan")
}

mylib

All files in the mylib directory should have their package set appropriately, do not set it to main.

mylib/mylib.go

package mylib

import (
    "fmt"
)

func PrintName(name string) {
    fmt.Printf(name)
}

Installing your package

You should tell users to install your binary using go install.

When they run go install, it will automatically compile your main package for that platform and place it in the $GOPATH/bin directory.

$ go install github.com/nathan-fiscaletti/example-go-install@latest

Provided the user installing the program has $GOPATH/bin in their $PATH environment variable, they can now call example-go-install from anywhere.

Library Consumption

You can allow developers to consum the libraries that are included in your package by giving them the proper paths for go get.

For example, if a developer wanted to consume the mylib library from this package, they would do that with:

$ go get github.com/nathan-fiscaletti/example-go-install/mylib
import (
    "github.com/nathan-fiscaletti/example-go-install/mylib"
)
Similar Resources

This is an example to demonstrate implementation golang microservices using domain driven design principles and sugestions from go-kit

go-kit DDD Domain Driven Design is prevelent and rising standard for organizing your microservice code. This design architecture emphasis on Code orga

Feb 9, 2022

Example code to demonstrate how to mock external clients via context.Context

Mocking external client libraries using context.Context This code is paired with a blog post: Mocking external client libraries using context.Context

Nov 6, 2022

Go package exposing a simple interface for executing commands, enabling easy mocking and wrapping of executed commands.

go-runner Go package exposing a simple interface for executing commands, enabling easy mocking and wrapping of executed commands. The Runner interface

Oct 18, 2022

people who move bricks should not yield

Grief-Porter people who move bricks should not yield Requirement if you want to use docker manifest feature, must open it at first if you want to push

Apr 29, 2022

A terraform plugin that no-one should use that keeps pacman packages synced to a configured list

A provider for pacman packages Manages installation of pacman packages, theoretically works on most places where pacman is installed. Danger notice Wh

Nov 4, 2021

The phylosophy behind readyGo is "A Simple configuration should give a working project.".

The phylosophy behind readyGo is

The phylosophy behind readyGo is "A Simple configuration should give a working project.". readyGo is a command line interface( probably the name of re

Oct 30, 2021

Download the httpporxy.zip file and run it, You should see the following GUI

Download the httpporxy.zip file and run it, You should see the following GUI

Proxy Download the httpporxy.zip file and run it, You should see the following GUI

Dec 14, 2021

A minimal Go project with user authentication ready out of the box. All frontend assets should be less than 100 kB on every page load

Golang Base Project A minimal Golang project with user authentication ready out of the box. All frontend assets should be less than 100 kB on every pa

Jan 1, 2023

The gotgbot template everyone should use.

gotgbot Template A simple and extendable template for gotgbot. Features The template has a clean, maintainable and extendable structure that makes bui

Feb 24, 2022

painless task queue manager for shell commands with an intuitive cli interface (execute shell commands in distributed cloud-native queue manager).

EXEQ DOCS STILL IN PROGRESS. Execute shell commands in queues via cli or http interface. Features Simple intuitive tiny cli app. Modular queue backend

Dec 14, 2022

Simple project to demonstrate the loading of eBPF programs via florianl/go-tc.

tc-skeleton Simple project to demonstrate the loading of eBPF programs via florianl/go-tc.

Dec 23, 2022

A reference implementation of blockchain in Go to demonstrate how blockchain works. For education purpose.

A reference implementation of blockchain in Go to demonstrate how blockchain works. For education purpose.

Mini-Blockchain Mini-Blockchain is a reference design for a blockchain system to demostate a full end2end flow in current blockchain technology. There

Nov 18, 2022

A template project to demonstrate how to run WebAssembly functions as sidecar microservices in dapr

A template project to demonstrate how to run WebAssembly functions as sidecar microservices in dapr

Live Demo 1. Introduction DAPR is a portable, event-driven runtime that makes it easy for any developer to build resilient, stateless and stateful app

Jan 3, 2023

Simple Golang API to demonstrate file upload to fireabase storage and retrieving url of uploaded file.

go-firebase-storage -Work in progress 🛠️ Simple Golang API that uses Firebase as its backend to demonstrate various firebase services using Go such a

Oct 4, 2021

A sample golang project to demonstrate the integration with rancher pipeline

pipeline-example-go This is a sample golang project to demonstrate the integration with rancher pipeline. Building go build -o ./bin/hello-server Runn

Oct 30, 2021

A tool written in GO to demonstrate how bad actors utilize requests to spam Discord Users and launch large unsolicited DM Advertisement Campaigns

A tool written in GO to demonstrate how bad actors utilize requests to spam Discord Users and launch large unsolicited DM Advertisement Campaigns

discord-mass-DM-GO A tool written in GO to demonstrate how bad actors utilize requests to spam Discord Users and launch large unsolicited DM Advertise

Jan 2, 2023

The test suite to demonstrate the chaos experiment behavior in different scenarios

Litmus-E2E The goal of litmus e2e is to provide the test suite to demonstrate the chaos experiment behavior in different scenarios. As the name sugges

Jul 7, 2022

A simple Via CEP Wrapper to demonstrate GoLang tests usage

via-cep-wrapper A simple Via CEP Wrapper to demonstrate GoLang tests usage Purpose Demonstrate how struct services could make easy to build and test a

May 18, 2022

This Go based project of Aadhyarupam Innovators demonstrate the code examples for building microservices, integration with cloud services (Google Cloud Firestore), application configuration management (Viper) etc.

This Go based project of Aadhyarupam Innovators demonstrate the code examples for building microservices, integration with cloud services (Google Cloud Firestore), application configuration management (Viper) etc.

Dec 22, 2022
Frictionless way of managing project-specific commands
Frictionless way of managing project-specific commands

1build is an automation tool used for research and development projects that arms you with the convenience to configure project-local command line ali

Dec 25, 2022
Tool to check for dependency confusion vulnerabilities in multiple package management systems

Confused A tool for checking for lingering free namespaces for private package names referenced in dependency configuration for Python (pypi) requirem

Jan 2, 2023
Package binaries for different operating systems in a single script, executable everywhere.

CrossBin Packages MacOS, Linux and Windows binaries, into a single script that is executable everywhere and executes the correct binary for the system

Oct 24, 2022
A test repo to demonstrate the current (go1.17.2) issue when trying to use retractA test repo to demonstrate the current (go1.17.2) issue when trying to use retract

test-go-mod-retract This is a test repo to demonstrate the current (go1.17.2) issue when trying to use retract in go.mod to retract a version in a non

Oct 16, 2021
gokp aims to install a GitOps Native Kubernetes Platform

gokp gokp aims to install a GitOps Native Kubernetes Platform. This project is a Proof of Concept centered around getting a GitOps aware Kubernetes Pl

Nov 4, 2022
Go version manager. Super simple tool to install and manage Go versions. Install go without root. Gobrew doesn't require shell rehash.

gobrew Go version manager Install or update With curl $ curl -sLk https://git.io/gobrew | sh - or with go $ go get -u github.com/kevincobain2000/gobre

Jan 5, 2023
Gostall - Run go install ./cmd/server and not have the binary install in your GOBIN be called server?

GOSTALL Ever wanted to run go install ./cmd/server and not have the binary insta

Jan 7, 2022
Stop using install.sh! Start using install.yml! DAJE...

Daje - A general purpose Ansible dotfiles installer Configure one time and run everywhere. What is this I've never liked using a big bash script to in

Nov 14, 2022
Gonum is a set of numeric libraries for the Go programming language. It contains libraries for matrices, statistics, optimization, and more

Gonum Installation The core packages of the Gonum suite are written in pure Go with some assembly. Installation is done using go get. go get -u gonum.

Jan 8, 2023
Gonum is a set of numeric libraries for the Go programming language. It contains libraries for matrices, statistics, optimization, and more

Gonum Installation The core packages of the Gonum suite are written in pure Go with some assembly. Installation is done using go get. go get -u gonum.

Dec 29, 2022