I'm trying to add a new package to my project with go modules. This package is using github.com/docker/docker/client and works fine outside of the project. When I run go mod vendor it pulls docker client package of version v1.13.1 which does not have some of the methods I am using in my code, but in go modules it is tagged as latest. How do I make go mod use the truly latest version of a package?
Go Wiki: Modules:
When needed, more specific versions of dependencies can be chosen with commands such as go get foo#v1.2.3, go get foo#master, go get foo#e3702bed2, or by editing go.mod directly.
If you need the latest commit on the master branch, use
go get github.com/docker/docker/client#master
This was driving me insane, too: Downloading the "master" or "latest" tag would often download versions one or two commits before HEAD. I found the answer here:
The go command defaults to downloading modules from the public Go
module mirror at proxy.golang.org. It also defaults to validating
downloaded modules, regardless of source, against the public Go
checksum database at sum.golang.org. These defaults work well for
publicly available source code.
And apparently there is some caching going on; if you wait a while it usually starts to work, alternatively it helps to temporarily set the version to a specific commit.
To fix it, I set GOPRIVATE=github.com/myuser.
In order to get the latest un-tagged version, you need to specify the commit tag you want to have when doing go get
go get github.com/docker/docker/client#[commit-hash]
Would recommend using a specific version (preferred tagged version, if not latest pseudo version instead of master). Having dependency versions locked down in the go.mod file ensures repeatability.
The latest version available in one of the go proxies is https://search.gocenter.io/github.com~2Fdocker~2Fdocker/info?version=v1.14.0-0.20190511020111-3998dffb806f
Spent the last 20 hours trying to fix a similar problem, in my case, the following steps solved the problem:
delete $GOPATH/pkg/sumdb
delete the go.mod and go.sum files
recreate the module: go mod init name
go test ./...
My circumstances don't align perfectly with the original question, but I feel it may be worth mentioning to help others in situations similar to mine:
Context
Was working with private modules, i.e., a Go module hosted from private git repository.
Access to the private repo was not an issue.
Would make and push changes to the private module.
A program that imported the private module would consistently pull an old version when running go get, even after running:
go clean -modcache
rm go.sum
go get
go mod tidy
Root Cause: I'm an Idiot
I had forgotten that Go uses VCS tagging with versioning.
Failed to update the tag to match the current commit.
The Fix
The version wasn't ready to be bumped (learning, here), so, in the private module, I ran the following command to align the version with the current commit:
Note: This assumes that all repo content has been staged/committed/pushed.
In the private module repo
git tag -d v0.0.0
git push --delete v0.0.0
git tag v0.0.0
git push origin v0.0.0
In the repo that was importing the private repo
go clean -modcache
rm go.sum
go get
go mod tidy
Related
I have a repository that utilizes electron-updater for auto update. The weird thing is, it has no any code whatsoever pointing where the release updates are stored (I store it in GitHub releases), but somehow the autoUpdater.checkForUpdatesAndNotify() still works. There is github remote origin but I doubt it's being used by electron-updater to find the repository. I don't use any GitHub token either.
The way I release update:
Increase the version in package.json
Run electron-builder, producing .AppImage
Create new release draft in my repository's GitHub releases
Upload the .AppImage file to the draft's assets and modify the draft's tag
Download the previous release, and then open it
Voila! The update works. But how?
It's worth mentioning that if latest-linux.yml is missing from the latest release's asset, it will throw 404 error and refuse to update despite knowing the latest version's tag.
Here's the repository I'm talking about: https://github.com/SnekNOTSnake/fresh-update/releases
Also, is this how normal people release their electron app? I tried the electron-builder --publish way, but it's troublesome compared to the manual steps above.
Thanks to Caramiriel in the comment section above for the enlightenment.
How electron-updater knows where to find the repository is from resources/app-update.yml inside the produced .AppImage file.
The app-update.yml file is produced by electron-builder using the information from git remote get-url origin (if available).
I proved it by changing the origin's url to https://github.com/SnekNOTSnake/tofu-tracker.git and build the AppImage, and (surprisingly enough) the repo's value became tofu-tracker.
We want to have the same VSCode settings for the whole crew of developers. Also it would be fine to have a oneline command to tear VSCode down and restart it from scratch with predefined settings and plugins so that you do not have to worry about trying out plugins and getting beck to the known state. Kind of Config-as-Code for VSCode.
I already found:
https://code.visualstudio.com/docs/editor/extension-gallery#_command-line-extension-management
https://github.com/microsoft/vscode-dev-containers
https://marketplace.visualstudio.com/items?itemName=Shan.code-settings-sync&ssr=false#qna
https://github.com/gantsign/ansible-role-visual-studio-code-extensions
https://code.visualstudio.com/docs/remote/containers
https://github.com/gantsign/ansible-role-visual-studio-code
But non of these provides a good solution to me
We are using Mac and Windows machines and develop most of the time locally (not remotely in the cloud or the like).
I imagine like having a script like
.... projectname up
or
.... projectname reset
(or
.... projectname down)
to receive/reset the configured settings and newest plugins that have been configured for the project.
Have any ideas or use a similar solution already?
After doing a lot of research, playing with Docker, Ansible and so on... it seems that although I excluded it at first the plugin Settings Sync Plugin from Shan Khan is the way to go. It has round about 1 million installs!
Only dependency - you need a GitHub account to host your configs. That is what held me back at first - but it should be not that much of a problem to get one for everyone in the team and connect it to like a company-github-account.
Copy the files settings.json and keybindings.json to your target machine(s) to copy the settings. You can find those files here:
Win: ~\AppData\Roaming\Code\User
Mac: ~/Library/Application Support/Code/User/
Linux: ~/.config/Code/User
You can copy extentions from ~/.vscode/extensions or C:\Users\username\.vscode\extensions from linux/mac or windows respectively.
FalcoGer's answer should explain how to copy the files in a way VS Code will pick them up. If you only need to copy the config files once, this solution would be fine.
If you need to "sync" these config files on a regular basis, I would advise to create a Git repository where all config files will be stored.
When cloning the repo to local machines, you can symlink the files to the config destinations (see FalcoGer's anwser). Then when you need to "sync", you only have to run git pull and restart VS Code to apply the changes.
For your other script-related question, you could create a CLI for this. Python would be the most friendly way to do this. You can find an example here.
How do i know that online reindexing is done ?
I had a repository with name datadelivery-feed-tcp-c++ which I moved to datadelivery-feed-tcp-cpp and deleted the datadelivery-feed-tcp-c++ repository.
But On kicking online reindexing it gives a lot of below warning.It is stuck at this warning.
[2017-09-28 07:00:27,300] [Index-Batch-3] WARN com.google.gerrit.server.index.change.StalenessChecker : error checking staleness of 8737 in datadelivery-feed-tcp-c%252B%252B
org.eclipse.jgit.errors.RepositoryNotFoundException: repository not found: Invalid name: datadelivery-feed-tcp-c%252B%252B
I have tried flushing cache also
ssh -p 29418 host gerrit flush-caches --all
How do I resolve it ?
EDIT : By renaming a repo I meant, I have cloned it and imported all the data into other project, verified it and then removed it using delete project plugin
I think you already had changes in the datadelivery-feed-tcp-c++ repository and you just renamed it at the filesystem, correct? You can't do that because you need to adjust the database data accordingly. The better way to rename a repository is doing the following:
1) Clone the original repository (with all existing changes) creating a new one with the new name. Use the importer plugin to do that.
2) Remove the original repository (and all related changes). Use the delete-project plugin to do that.
Notes:
i) In your current case, first rename the repository back to the original name at the filesystem.
ii) You can download the plugins here.
Hello fellow programmers,
I accidentally added my whole project to my project, not once, but twice, as I was looking for another functionality. Since the folders didn't show up in Xcode itself, I went to Finder and deleted them manually from the filesystem again (so far so good, since I got all warning 4x).
But now, when I want to commit changes to the sourceCode control, I get this error:
fatal: Could not switch to '/Users/myID/Developer/iOS/ProjectName/ProjectName/ProjectName': No such file or directory
I have pretty much no clue what to do, has anyone ever had such a problem? Cleaning the project does not help, that's all I could think off, as I'm not that experienced!
Help I HIGHLY appreciated!
PS: I'm running Xcode 4.3.2 on OSX 10.7.4
For something as serious as this I would create a new git repo, starting from the commit revision before the screw-up.
Assume your code is in ~/Source/MyProject.
First you are going to need the commit revision before the screw-up. You can get his from the command line using git log or better still you can use the excellent (and free) SourceTree Mac App. Lets assume it's 62a6614fb55d692cd5a6e251cc05dea45d9668fe.
Next start a new repo: $ mkdir ~/Source/MyProjectNew; cd ~/Source/MyProject/New; git init.
Add the old project as the 'remote origin' of the new project: $ git remote add origin ~/Source/MyProject.
Fetch the pre-screwed code: $ git fetch origin 62a6614fb55d692cd5a6e251cc05dea45d9668fe.
Reset the master branch to the pre-screwed commit: $ git reset --hard FETCH_HEAD.
Remove the origin: $ git remote rm origin.
You now have a new repo without the screwed-up code. You need to rename the old and new repo and carry on with your life.
i have a directory with some .php files in it...do i need to install symfony in that directory so that i can run symfony commands from that directory?? i tried: pear channel-discover pear.symfony-project.com
and got:
Channel "pear.symfony-project.com" is already initialized
the i tried: pear install symfony/symfony
and got:
WARNING: configuration download directory "/build/buildd/php5-5.3.2/pear-build-download" is not writeable. Change download_dir config variable to a writeable dir to avoid this warning
Cannot install, php_dir for channel "pear.symfony-project.com" is not writeable by the current user
how do i fix this please? must i run it as sudo??
thanks
If I remember well, Symfony is "system-wide" if installed through PEAR (like you are trying to do).
Now it is recommended by the manual to do a "standalone" install through SVN. See http://www.symfony-project.org/gentle-introduction/1_4/en/03-Running-Symfony
As well, the sandbox will bring a "standalone" installation of Symfony (you will have to be in the project root directory to be able to run the symfony commands)
EDIT
Example of quick install using SVN:
mkdir /path/to/symfony
cd /path/to/symfony
svn checkout http://svn.symfony-project.com/tags/RELEASE_1_4_0 .
but it should be better to follow the manual and configure the external SVN sources.
I run servers where I have applications that use different versions of symfony simultaneously. I found it much easier to deal with the SVN checkout than the PEAR insteall.
So what I've done is do an SVN checkout of each revision that I need
into it's own folder. In my case i check them out to
/usr/share/symfony/(version)
Then I configure the ProjectConfiguration.class.php to reference whatever version is needed, using the line:
require_once '/usr/share/symfony/1.x.x/lib/autoload/sfCoreAutoload.class.php';
If I need to switch to a different symfony version, I can just change that config.
That is, assuming all my code is compatible with that version