This is inspired by A half-hour to learn Rust and Zig in 30 minutes.
Your first Go program as a classical "Hello World" is pretty simple:
First we create a workspace for our project:
This is inspired by A half-hour to learn Rust and Zig in 30 minutes.
Your first Go program as a classical "Hello World" is pretty simple:
First we create a workspace for our project:
| func main() { | |
| s := time.Now() | |
| args := os.Args[1:] | |
| if len(args) != 6 { // for format LogExtractor.exe -f "From Time" -t "To Time" -i "Log file directory location" | |
| fmt.Println("Please give proper command line arguments") | |
| return | |
| } | |
| startTimeArg := args[1] | |
| finishTimeArg := args[3] |
| window.onload = function() { | |
| fetch('./swagger.json') | |
| .then(function(response) { | |
| response.json() | |
| .then(function(json) { | |
| json.schemes[0] = window.location.protocol.slice(0, -1) | |
| json.host = window.location.host | |
| const ui = SwaggerUIBundle({ | |
| spec: json, |
| mholt [9:10 AM] | |
| When using http.Get(), is it really necessary to read the full response body just to close it later? | |
| [9:10] | |
| The docs keep saying `Caller should close resp.Body when done reading from it.` and I keep seeing code like this: | |
| ``` | |
| io.Copy(ioutil.Discard, resp.Body) | |
| resp.Body.Close() | |
| ``` |
Directly from CLI
alias x='exit'
funcsave x
or create a file in
~/.config/fish/functions
with name
| local redis_c = require "resty.redis" | |
| local ok, new_tab = pcall(require, "table.new") | |
| if not ok or type(new_tab) ~= "function" then | |
| new_tab = function (narr, nrec) return {} end | |
| end | |
| local _M = new_tab(0, 155) |
| package main | |
| import ( | |
| "database/sql" | |
| "database/sql/driver" | |
| "errors" | |
| "fmt" | |
| _ "github.com/mattn/go-sqlite3" | |
| ) |
| package main | |
| import ( | |
| "fmt" | |
| "reflect" | |
| ) | |
| func Decorate(impl interface{}) interface{} { | |
| fn := reflect.ValueOf(impl) |
There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's .gitignore is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the node_modules directory) as well as files that are generated (and regenerated) as artifacts of a build process.
All other files should be in your own global gitignore file:
.gitignore in your home directory and add any filepath patterns you want to ignore.Note: The specific name and path you choose aren't important as long as you configure git to find it, as shown below. You could substitute
.config/git/ignorefor.gitignorein your home directory, if you prefer.