alco / gostart Goto Github PK
View Code? Open in Web Editor NEWA getting started guide for Go newcomers
A getting started guide for Go newcomers
I am starting with go and I ended up on this page
I was surprised by the lack of an official dependency management tool, but after I complained on twitter, people recommended "dep" to me, and it seems very sane and semi-official.
It should be mentioned here! This is one of the pages one will find when googling around about go ecosystem.
Two things keep puzzling me:
Also go dep
might deserve mentioning as it does seem to support package versions?
I think it'd probably be better to extract the points from that section into FAQ entries, and/or convert that section to pointers into the FAQ
Here's an attempt at breaking that section apart into FAQ entries:
Coming from other languages/environments, you may expect that go
is a full on package management solution. It isn't! The following FAQ entries might be useful:
...
There is no widely adopted solution for package version management, currently. The go tool has no knowledge of package versions; though it does choose package versions (vcs tags) based on your current go version.
The currently accepted approach is to build all of your dependencies off of master. Running go get -u ./...
to update your locally cached dependencies is helpful to stay out of trouble, though not ideal.
Before you get up in arms and race off to write your own package version manager, be sure to read through discussion of the previous attempts at this:
go tool does not provide any way to create a reproducible environment for fool-proof deployments.
If you tested your code locally, you can never be sure that it'll work during your next deploy, because one of the dependencies might introduce a breaking change during the time period between your testing and deployment.
The only apparent solution to this is to package up your downloaded dependencies and copy them over to your production environment. Manually. You might find goven useful to automate this.
In "The Go way" section, IMHO we need to reveal sub.go to ease the understanding how the sub.go 'template' works.
Deployments to production in most cases (appengine is a weird exception) are by compiling and then copying the statically linked binary to your production servers. Making deployment trivial.
no freedom to write go code anywhere in your file system
no support for setting up a reproducible development environment or packaging a locally set up environment
URL-ish looking imports in your code
urls are unique and hierarchical. This makes them ideal for representing namespaces and giving every package a unique name while avoiding the issue of having to bless certain people with the ability to use certain names. eg. cpan, pypi, rubygems.
I just wanted to ask if changes introduced by go mod and go 1.12 don't make this repository a bit outdated/obsolete ?
this addresses "15. How do I manage package versions?"
this is something that's driving me mad, how is nobody seeing the most simplest solution?
go lets you import an arbitrary path (which sort of works like a url) which specifies exactly what you want, there is no need for vcs specific bullshit like tags or branches...
you just use a vcs agnostic approach of placing a copy of each stable version of the package into a separate directory, while having a special one for development, and if you have some large assets that are mostly same for each version you just have that in root of repo and reuse it every version, so structure would look like this:
my_package
| - dev
| - v1
| - v2
this way you would have literal vcs agnostic version branches...
and you would import by just doing import "example.com/my_package/v2"
why does nobody use this?
...it's best because it's simple and it works and requires no specific vcs knowledge...
also if you think that this wastes space and duplicates too much code, then current solution of using vendoring is far worse as every package that uses some popular package would have a copy of it duplicating it many times over...
Kindly help me solve this problem. When I import links it gives this error but when I downloaded data for the links it solves the error. but I have so many links that it will take so much time to download all the data and put it in the "src" folder of go lang.Is there anyway to access links in go language?
becouse pygments not support shell syntax
change like this
```shell
to
```bash
Go lang 1.14 on Windows 10 x64
Error --
server\server.go:6:2: no Go files in c:\go\src\blocky\docs
I'm a Go lang newb so not sure what to do from here.
https://blog.gopheracademy.com/advent-2015/vendor-folder/
seems to be common practice. Maybe say something about that?
This file is notably missing license file. Is there any reason for that?
I'm working through the FAQ top to bottom. When working on FAQ 4, I create example/main.go
and example/math/math.go
exactly as described here: https://github.com/alco/gostart#faq4
However, I get this error:
➜ example go run *.go
main.go:5:5: import "example/math": cannot find package
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.