-1

Our server can not connect to the Internet because of security lock down.

To be able to use GO with 3rd party modules, I see that we have to options

1) Our laptops can connect to the internet. Is it possible to "go get github...." on the laptop and then copy that module to the server? How would we do this?

2) We have a GOGS server on the network. Would it be possible to clone the github repository and then push it as a private repository to the GOGS server? What changes do we need to make to the GO configuration? (This would be the preferred option if it is possible)

PrestonDocks
  • 4,851
  • 9
  • 47
  • 82
  • 2
    Is this a build server or a server you're running a service on? If you're just deploying a service, deploy the binary instead of the source. – Adrian Nov 07 '17 at 19:21
  • "...copy that module to the server? How would we do this?" Well, by use if tar and scp? – Volker Nov 07 '17 at 19:21

2 Answers2

0
  1. Most probably all the sources of all your projects and all external libraries are inside a $GOPATH dir. Just sync needed folders and you are done.

  2. Yes, that is possible. After pushing a Github repo clone to your Gogs server - all you need to do is to import a package (go get) from new location and in your sources you have to replace "github.com" with what you have, something like "gogs.local":

import "gogs.local/username/packagename"

Alexey
  • 2,582
  • 3
  • 13
  • 31
0

You should use Godep, a dependency tool for go.

How to use godep with a new project

Assuming you've got everything working already, so you can build your project with go install and test it with go test, it's one command to start using:

$ godep save

This will save a list of dependencies to the file Godeps/Godeps.json and copy their source code into vendor/

So you will have inside your project the dependencies (if you do those steps in your development machine).


Github: github.com/tools/godep
mayo
  • 3,845
  • 1
  • 32
  • 42