How to find go package version? - go

I am not using go modules. Have a bunch of packages present in my company's toolchain (i.e. I didn't install the packages and thus can't check my bash history for package version).
So the packages are present in $TOOLCHAIN_PATH/go/src. Is there any way I can find the version of a particular package.
If it helps, I want to find out the package version of crypto/tls.

I am not using go modules
So you are doing it wrong. It's 2021, you must use modules. Use modules.
I want to find out the package version of crypto/tls
This is a package of the stdlib which is shipped with your compiler and it is "unversioned" as a package. Run go version to see the version of your compiler/stdlib combination as a whole.

Related

main packages in go 1.18.1 built-in libraries

I am trying to upgrade my project's golang version from 1.15 to 1.18.1. I changed the version in go.mod and executed go mod tidy command.
Weird thing, I got following error in my main file which has a main function inside itself:
'main' collides with name declared in this package
It happens for net/http and syscall libraries:
net/http
Found several packages [http, main] in '/usr/local/go-1.18.1/src/net/http;/usr/local/go-1.18.1/src/net/http'
syscall
Found several packages [syscall, main] in '/usr/local/go-1.18.1/src/syscall;/usr/local/go-1.18.1/src/syscall'
As I checked the warning was correct and there were main packages in both libraries.
Should I use an alternative library or should I change the way I import them?
Edit 1:
This is an IDE error and I use Goland.
This was reported recently (Apr. 2022) (link in Chinese)
The translation of the relevant comment is:
The reason for the above error: Your Go language version has been upgraded, and the IDE version is too old to support it.
For example, in my case, Go was upgraded to 1.18, and Goland was not upgraded.
So make sure your IDE (GoLand or VSCode) is fully updated (with, for VSCode, the latest gopls).

Unable to setup Gandalf Go

I am trying to setup Gandalf but when I do go get github.com/JumboInteractiveLimited/Gandalf I'm getting error
package github.com/jmartin82/mmock/definition: cannot find package "github.com/jmartin82/mmock/definition" in any of:
/usr/local/go/src/github.com/jmartin82/mmock/definition (from $GOROOT)
<My_Go_Path>/src/github.com/jmartin82/mmock/definition (from $GOPATH)
I'm using testing file from
This reached me via a GitHub Issue however I thought it best to mention it here for clarity.
Gandalf utilizes go modules to pin dependency versions, go get will download the latest version of a dependency rather than the version a project actually supports where as something like go mod download will respect the go.mod file and fetch the correct version. The mmock project has changed its package structure making newer versions of it not backwards compatible.
I recommend getting antiquated with go modules as they seem to be the way forward now and have been enabled by default in newer versions of the go compiler. If I remember correctly you may already have support for it you just need to set the environment variable GO111MODULE=on when dealing with projects that have a go.mod file.

Is there any package management system for MinGW+MSYS?

I am trying to compile some open source libraries in MinGW+MSYS. During the configure phase, I kept seeing some 3rd party libraries are missing.
For now, my solution is to download the source of the missing libraries and follow the GNU build process to compile and install them into my MinGW environment.
Is there any package management system for MinGW+MSYS to install packages easily? Just like apt-get.
I tried the mingw-get for the missing package. But it reports the error below.
mingw-get is the (closest equivalent to apt-get) package manager for MinGW and MSYS. However, it can only manage packages which are actually available for MinGW and/or MSYS, (either because a MinGW developer has built and packaged them, or a member of the MinGW user community has contributed them).
Arbitrarily guessing what packages may be available, and even what their correct package names may be, is unlikely to be productive. Run mingw-get in its GUI mode, (if it's properly installed, just running mingw-get without arguments should start it in this mode), to see a list of packages which are actually available; if you don't see any likely candidates for what you are looking for, then it doesn't (yet) exist. In that case, you will need to either find a non-MinGW alternative build, or build it yourself, from source. (If you choose the latter option, and your build is successful, then you may wish to consider contributing it to MinGW.org).
This works for me as a "package manager".
Install MSYS2. It comes with a package manager called pacman.

Is it possible to merge/obsolete Solaris SVR4 packages?

Package formats like RPM and DPKG have the concept of 'replaces' or 'obsoletes', which can be used when merging one package into another.
Do Solaris SVR4 packages support a similar concept? The closest I can find is the 'depend' file, which allows me to define a conflict, but not how to resolve it.
No. The Solaris installer kept track of these separately from the package system itself in order to do Solaris upgrades, and only for the packages that were part of the OS. The provided SVR4 package commands have no notion of upgrades, nor of dependency resolution, only install & remove of the exact versions specified of the exact packages specified.
These are among the many features added by the IPS package system that replaced SVR4 packages in Solaris 11.

How to check a makefile for dependencies?

I'm trying to install something with the following command:
make world
It takes a long time, and usually it ends up with an error saying that I'm missing some kind of package. I found out what the package is, install it, and run the thing again, only to find out after a long time that I'm missing another package. Is there a way to find out all the packages I need to install without having to go through this process?
This is generally what the configure script does. If the project you're building doesn't have one, you should write one.
The best way to deal with dependencies is with a package manager such as:
On Ubuntu: apt-get
On Red Hat / Fedora: yum
On Mac OS X: port
On Windows: cygwin
If you install software with a package manager, it will automatically fetch, download, and install any dependencies as necessary. These package managers support a huge number of popular open source projects, but not all projects are supported. Some of these package managers support creating custom package repositories, which allows them to be used for dependency management in-house, as well.
Unfortunately, there is no general way to get all the library dependencies of a Makefile (short of grepping for "lib", ".so", and "-l" which may give you spurious results); however, if you are installing an open source project, chances are that it is supported by a package manager on your system.

Resources