Is Go better than C1

programming language: Go 1.10 caches better and builds bridges to C

Version 1.10 of the Go programming language initiated by Google has been released. The cache for the generated packets is now in the command go build built in, but also in go test. Go separates this generated cache from that for installed packages. The advantage of this becomes apparent in build processes: They run much faster if you don't have to install new packages or when switching between different source code copies, for example in development branches. The quick build option -i the new cache also makes it superfluous. The command go test however, runs the previous test again and indicates that the results are from the cache. The option -count = 1 ignores the cache.

  1. PCV Systemhaus GmbH & Co. KG, Grevenbroich
  2. HA Hessen Agentur GmbH, Wiesbaden

The command detects obsolete packages go build also automatically in the new version. To do this, the tool checks the contents of the source files, the build flags and the metadata in the compiled packages. The modification time, on the other hand, no longer plays a role, builds now automatically know when a package has to be rebuilt.

The options -asmflags, -gcflags, -gccgoflags and -ldflags for the command go build now only affect the packages specified in the command line and no longer also affect the packages that are dependent on them. In order to meet packages according to a certain pattern, a new form must be chosen: -asmflags = pattern = flags. This also works in the same way with the other flags mentioned. Reveals more details go help build. By the way, it is similar with go install, which now only installs the packages and commands explicitly mentioned on the command line.

Smarter environment variables

In Go 1.10 a new environment variable can be added, $ GOTMPDIR, to create temporary files in a folder other than the system's temporary directory. Ain't no $ GOROOTVariable is set, the tool first tries to find the $ GOROOT- Track down path by yourself. This allows binary distributions to be unpacked anywhere in the file system, even without first $ GOROOT to put.

  1. Introduction to programming with Rust
    21.-24. September 2021, online
  2. Advanced Python - Advanced programming topics
    17./18. June 2021, online
Further IT training

Anyone who writes C code can now use the C preamble _GoString_ access string values ​​in his Go program. _GoStringLen and _GoStringPtr allow direct access to the contents of the string. A _GoString_Value can also be passed on to a Go function that accepts strings. The release notice reveals more details about Cgo and the other changes to the new version.