GithubHelp home page GithubHelp logo

go-mod-internals's Introduction

This repo is merely a function, exported as it was a library. Its main purpose is to explore Go modules internals. Modules is the most recent way of managing dependencies in Go. From version 1.13+ modules became the default.

I first created it private and made it public so you may learn from it. I hope it works for your private repos too. I believe there are different ways to solve this problem. :)

Resolving private dependencies

Configurations

Environment variable

export GOPRIVATE="github.com/<username>,github.com/<username>,github.com/<username>"

Notice that it allows you to define multiple repos.

Enforcing SSH via Git

git config --global url."ssh://[email protected]/".insteadOf "https://github.com/"

Now, if you want to use it in another project, run the following:

go get -v github.com/axcdnt/go-mod-internals

The go.mod must be correctly updated with the code from this lib.

Dependencies resolved, it's now possible to import and use it:

package main

import "github.com/axcdnt/go-mod-internals/stringer"

func main() {
	stringer.Tokenize("what a cool string") // ["what", "a", "cool", "string"]
}

For more details, please check Go 1.13.

Docker

After a person asked on Gophers Slack how it works with Docker I decided to try. For the app using the lib, all you have to do is vendorize it:

go mod vendor

go-mod-internals's People

Contributors

axcdnt avatar

Watchers

 avatar  avatar  avatar

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.