For Mac and Windows users, just install Docker Toolbox. It provides what you need to get started, including:
| package main | |
| import ( | |
| "log" | |
| "bufio" | |
| "time" | |
| "os" | |
| "fmt" | |
| "io" | |
| "net" |
| package main | |
| import ( | |
| "flag" | |
| "io" | |
| "log" | |
| "net" | |
| "net/http" | |
| "strings" | |
| ) |
| <script> | |
| // A minimal polyfill for copying text to clipboard that works most of the time in most capable browsers. | |
| // Note that: | |
| // - You may not need this. `navigator.clipboard.writeText()` works directly in all modern browsers as of 2020. | |
| // - In Edge, this may call `resolve()` even if copying failed. | |
| // - In Safari, this may fail if there is nothing selected on the page. | |
| // See https://github.com/lgarron/clipboard-polyfill for a more robust solution. | |
| // | |
| // License for this Gist: public domain / Unlicense | |
| function writeText(str) { |
| 'use strict'; | |
| class Abstract { | |
| // A static abstract method. | |
| static foo() { | |
| if (this === Abstract) { | |
| // Error Type 2. Abstract methods can not be called directly. | |
| throw new TypeError("Can not call static abstract method foo."); | |
| } else if (this.foo === Abstract.foo) { | |
| // Error Type 3. The child has not implemented this method. | |
| throw new TypeError("Please implement static abstract method foo."); |
| package main | |
| import ( | |
| "fmt" | |
| "net/http" | |
| "sort" | |
| "time" | |
| ) | |
| // a struct to hold the result from each request including an index |
| #include "FastLED.h" | |
| #define NUM_LEDS 60 | |
| #define DATA_PIN 3 | |
| CRGB leds[NUM_LEDS]; | |
| uint8_t hue = 0; | |
| void setup() { | |
| FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS); |
This gist is based on the information available at golang/dep, only slightly more terse and annotated with a few notes and links primarily for my own personal benefit. It's public in case this information is helpful to anyone else as well.
I initially advocated Glide for my team and then, more recently, vndr. I've also taken the approach of exerting direct control over what goes into vendor/ in my Dockerfiles, and also work from
isolated GOPATH environments on my system per project to ensure that dependencies are explicitly found under vendor/.
At the end of the day, vendoring (and committing vendor/) is about being in control of your dependencies and being able to achieve reproducible builds. While you can achieve this manually, things that are nice to have in a vendoring tool include:
| package main | |
| import ( | |
| "context" | |
| "fmt" | |
| "log" | |
| "net/http" | |
| "os" | |
| "os/signal" | |
| "strconv" |
| // Package main is a sample macOS-app-bundling program to demonstrate how to | |
| // automate the process described in this tutorial: | |
| // | |
| // https://medium.com/@mattholt/packaging-a-go-application-for-macos-f7084b00f6b5 | |
| // | |
| // Bundling the .app is the first thing it does, and creating the DMG is the | |
| // second. Making the DMG is optional, and is only done if you provide | |
| // the template DMG file, which you have to create beforehand. | |
| // | |
| // Example use: |