I'm trying to make it easy for the not-too-technical to use my golang program as a command line application. I want them to be able to update the code easily too when I push changes to github. Is there a way to update a library using something like "go update github.com/user/repo" so they don't have to cd to the src directory and git pull themselves? Or at this point must I simply say "time to learn git"?
You can use:
go get -u import/path
The -u flag instructs get to use the network to update the named packages
and their dependencies. By default, get uses the network to check out
missing packages but does not use it to look for updates to existing packages.
Related
Using {targets} to manage a workflow, which is great.
We don't have a proper cluster setup, but I have access to remote machines with much better specs than my laptop, so I can use git to keep the plan in sync locally and remotely.
When I want to work with something locally, I use rsync to move the files over.
rsync -avxP -e "ssh -p ..." remote:path/to/_targets .
When I query the remote cache with tar_network, I see that a bunch of my targets are "uptodate".
When I query the local cache after the rsync above, those same targets are "outdated".
I'm wondering if there is either better calls to rsync or certain arguments to tar_network(), or if this is a bug and the targets should stay as "uptodate" after an rsync like this?
OK, so I figured this out.
It was because I was being foolish about what was a target in this case. To make sure that a package dependency was being captured, I was using something that grabbed the entire DESCRIPTION of the package (packageDescription() I think). The problem with that is, is that when you install the package using remotes::install_github(), is that it adds some more information to the DESCRIPTION upon installation (packaged and built fields), and that information differed between the installation on my local machine and the installation on the remote machine.
What I really wanted was just the GithubSHA1 bit from the packageDescription(), to verify that I was using the same package at the same commit from my GitHub repo. Once I switched to using that instead of the entire DESCRIPTION, then targets had no issues with the meta information and things would stay current when rsync'ing them between machines.
I'm getting used to Go, and trying to understand how it works.
So I'm trying to run the test code from my repository zoonoo/go-ethereum, forked from the original repository ethereum/go-ethereum.
When I run go test . under the eth directory, I get the following error :
eth/api.go:37:2: use of internal package not allowed
37th line of eth/api.go is as follows : "github.com/ethereum/go-ethereum/internal/ethapi"
Does this mean when you fork a go repository, you have to change the path of all dependencies within the code to run the code?
Does Go package system support repository fork at all?
As illustrated in another Go project:
Cloning a fork
If you wish to work with fork of InfluxDB, your own fork for example, you must still follow the directory structure above. But instead of cloning the main repo, instead clone your fork. Follow the steps below to work with a fork:
export GOPATH=$HOME/gocodez
mkdir -p $GOPATH/src/github.com/influxdb
cd $GOPATH/src/github.com/influxdb
git clone git#github.com:<username>/influxdb
Retaining the directory structure $GOPATH/src/github.com/influxdb is necessary so that Go imports work correctly.
Replace InfluxDB name/URL by your project, and the same idea applies.
In your case, the GitHub fork is only there for you to push your contribution back to it, and to make Pull request from it.
It won't serve as a source for go get to work, since the packages wouldn't match your GitHub for repo URL.
This is because internal packages in go can only be imported by packages in the same directory root. It's kind of like package private classes in java. If you want to edit the code without having to rename all package imports you need to maintain the same folder structure that the package expects so if github.com/zoonoo/go-ethereum is in your $GOPATH rename the directory to github.com/ethereum/go-ethereum or create a symbolic link and work from the linked directory instead.
I have Go installed, setup, and running hello world; I followed these directions. My workspace is organized as follows:
gocode/
bin/
pkg/
src/
github.com/
my_username/
hello/
hello.go
anomalyzer/
algorithms.go
...
README.md
I would like to start using Go code from a forked GitHub repo, lytics/anomalyzer. How can I do this? I forked the repo and setup a local clone in github.com/anomalyzer/ as shown above. But from the github.com/anomalyzer/ dir I try go install and get the error message algorithms.go:5:2: cannot find package "github.com/drewlanenga/govector" in any of: ...(lists my GOPATH). It looks like I need to also clone the github.com/drewlanenga/govector, do I? Is there an automated way to get all the package dependencies?
To fetch remote packages, run the go get command. Because the go get command automatically fetches dependencies and does not fetch a package that already have have, you can run
go get github.com/lytics/anomalyzer
to get everything setup including the github.com/drewlanenga/govector package.
When I include twitter bootstrap using bower I want to install the files from https://github.com/twbs/bootstrap/tree/master/dist. I do not want all the files I get from the master branch. Is this possible using bower.json?
Thanks!
So the answer currently is NO.(Jan/2014) You get what is in the git repository you are pulling from.
This is not all bad. I you use Bower with Yoeman you can set up a build process that generates the desired result.
How to update sources using jazz scm.
I used this command:
lscm load -r "https://rtcserver.com" workspace
And it downloaded whole repository into current directory. Unfortunately I don't know how to update sources when there is new code checked-in. I tried to use accept command but it doesn't work for me or I'm doing something wrong:
lscm accept -r "https://rtcserver.com" --flow-components -v
This one every time returns "Workspace unchanged." But it is changed!
Edit the files you wish to change. Then use "lscm checkin" to create a change set on your repository workspace, and "lscm deliver" if you want to push that change set back to the stream.
See the online help # http://pic.dhe.ibm.com/infocenter/rtc/v2r0m0/index.jsp?topic=%2Fcom.ibm.team.scm.doc%2Ftopics%2Fm_cli_usecases.html