Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Regular file names are lower case, short, and without any sort of underscore or space. Generally, file names follow the same convention as package names. See the Package Names section of Effective Go.
  • File names that begin with "." or "_" are ignored by the go tool
  • Files with the suffix _test.go are only compiled and run by the go test tool.
  • Files with os and architecture specific suffixes automatically follow those same constraints, e.g.  name_linux.go will only build on linux, name_amd64.go will only build on amd64.

Line Feeds

Line endings in code files are different for *nix versus Windows.  In *nix, lines end with “\n”.  In Windows, lines end with “\r\n” (carriage return, line feed).  This creates issues when pulling/working with code created in different environments.

The *nix line feed is the desired line ending for EdgeX Foundry source code.  Windows developers need to configure tools to use and apply the appropriate line endings.  Thanks to Gorka Garcia from Cavium, here are some examples of how to configure some popular tools to deal with this issue.

  • For Eclipse (Version: Oxygen.2 Release (4.7.2)), go to “Window > Preferences > General > Workspace” settings and find “New text file line delimiter” and set it to “Other: Unix”, this will set the line endings for new files. There is also  “File > Convert Line Delimiters To > Unix” option for converting files already with windows line endings.
  • For Microsoft Visual Studio Code (v1.19.2) you need to add the following to the user configurations:

    "files.eol": "\n"

  • For Notepad++ (v7.5.1) go to "Settings > Preferences > New Document/Default Directory" then select "Unix/OSX"

Vendoring

Go programs are often comprised of packages from many different sources. Each one of these sources are pulled in from the GOPATH or from the standard library.  With Go 1.5 a new method to discover go packages was released. Nothing has been changed or added to the go language or the go compilers. Packages must still reside in GOPATH. However, if a package or a parent folder of a package contains folder named vendor it will be searched for dependencies using the vendor folder as an import path root. There are many tools that use the vendor folder today.  Glide and govendor are two that are popular.  The EdgeX Go community has chosen to use Glide as its vendoring tool of choice and will use this tool to check dependencies when code gets checked into source control?

...