Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

You may find some resources in docs:

Index

  1. My Posts On X
  2. Interesting Reads
  3. Others
  4. JQ

My Posts On X

1 - Setup and entry points (Nothing much)

2 - Became a Boot.dev member

3 - Naked Return Dilemma

4 - Type assertions

5 - URL shortener Project

6 - Interfaces

7 - Panic

8 - Variadic and spread operator

9 - Strings / Unicode

10 - Pointers

11 - Goroutines

12 - Channels

13 - Escape analysis

Interesting Reads

Others

  ### Go Proverbs

  ___

  Don't communicate by sharing memory, share memory by communicating.

  Concurrency is not parallelism.

  Channels orchestrate; mutexes serialize.

  The bigger the interface, the weaker the abstraction.

  Make the zero value useful.

  interface{} says nothing.

  Gofmt's style is no one's favorite, yet gofmt is everyone's favorite.

  A little copying is better than a little dependency. // Yup, I know this one from somewhere 😅

  Syscall must always be guarded with build tags.

  Cgo must always be guarded with build tags.

  Cgo is not Go.

  With the unsafe package there are no guarantees.

  Clear is better than clever.

  Reflection is never clear.

  Errors are values.

  Don't just check errors, handle them gracefully.

  Design the architecture, name the components, document the details.

  Documentation is for users.

  Don't panic.

JQ

jq is a powerful command-line tool for processing JSON data. It's a favorite among developers for working with JSON because it can:

  • Parse JSON: easily read and extract data from JSON responses.
  • Manipulate JSON: modify JSON data on the fly.
  • Filter JSON: find exactly what you're looking for within large JSON structures.

Example Suppose you have a JSON file named user.json with content:

  {
    "name": "John",
    "age": 30,
    "city": "New York"
  }

To extract the name field, you would use the object identifier index like so:

  jq '.name' user.json
  # "John"

To get a field from each element in an array you can use the array/object value iterator .[], which can in turn be combined with the identifier index like so:

  curl https://jsonplaceholder.typicode.com/users | jq '.[].username'
  # "Bret"
  # "Antonette"
  # "Samantha"
  # "Karianne"
  # "Kamren"
  # "Leopoldo_Corkery"
  # "Elwyn.Skiles"
  # "Maxime_Nienow"
  # "Delphine"
  # "Moriah.Stanton"

Multiple Fields

  curl https://jsonplaceholder.typicode.com/users/1 | jq '.name, .email'
  # "Leanne Graham"
  # "Sincere@april.biz"
  • Another typical use is curl to parse JSON responses directly from HTTP requests. Eg.
  curl https://jsonplaceholder.typicode.com/users/1 | jq .username
  # "Bret"

About

My Golang sandbox. Several concepts, and Ideas I picked up, some simple projects from bootdev, and other go resources

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages