Go Recipes: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
=Internal=
=TO DEPLETE and MERGE=
<font color=darkkhaki>
 
Into [[Go Code Examples]]


* [[Go#Subjects|Go]]
* [[Go Concepts - Standard Library|Standard Library]]


=Files=
=Files=
Line 12: Line 13:
* Writing a file with <tt>[[Go Package io|io/ioutil]]</tt> primitives: [https://github.com/NovaOrdis/playground/blob/master/go/files/write-file-2.go playground/go/files/write-file-2.go]
* Writing a file with <tt>[[Go Package io|io/ioutil]]</tt> primitives: [https://github.com/NovaOrdis/playground/blob/master/go/files/write-file-2.go playground/go/files/write-file-2.go]
* Reading a directory with <tt>[[Go Package os|os]]</tt> primitives: [https://github.com/NovaOrdis/playground/blob/master/go/files/read-dir.go playground/go/files/read-dir.go]
* Reading a directory with <tt>[[Go Package os|os]]</tt> primitives: [https://github.com/NovaOrdis/playground/blob/master/go/files/read-dir.go playground/go/files/read-dir.go]
* Walking a directory with <tt>[[Go Package path|path/filepath]]</tt> primitives: [https://github.com/NovaOrdis/playground/blob/master/go/files/walk-dir.go playground/go/files/walk-dir.go]
* Walking a directory with <tt>[[File_Paths_and_Names_in_Go#filepath|filepath]]</tt> primitives: [https://github.com/NovaOrdis/playground/blob/master/go/files/walk-dir.go playground/go/files/walk-dir.go]
</blockquote>
</blockquote>


Line 49: Line 50:
:[[Go_Package_time#time.Sleep.28.29|sleep]]
:[[Go_Package_time#time.Sleep.28.29|sleep]]
</blockquote>
</blockquote>
=Miscellaneous=
* Using channels to monitor the amount of time a program is running and time it out, signals: "Go in Action" Section 7.1 Runner (page 179), [https://github.com/NovaOrdis/playground/blob/master/go/go-in-action/runner playground/go/go-in-action/runner]
* Pooling "Go in Action" Section 7.2 page 188
* Workers "Go in Action" Section 7.3 page 198


=Conventions and Idioms=
=Conventions and Idioms=


* Name factory functions <tt>New</tt>.
* Name factory functions <tt>New</tt>. The factory functions should return a value or a pointer depending on the [[Go_Concepts_-_The_Type_System#Primitive_vs._Non-Primitive_Nature|primitive nature of the type]].

Latest revision as of 22:23, 16 October 2023

TO DEPLETE and MERGE

Into Go Code Examples


Files

Network

  • RPC - Introducing Go page 89

Command Line Parsing

Go Command Line Parsing

Concurrency

Logging

Changing the Logging Device

Sleeping

sleep

Miscellaneous

  • Using channels to monitor the amount of time a program is running and time it out, signals: "Go in Action" Section 7.1 Runner (page 179), playground/go/go-in-action/runner
  • Pooling "Go in Action" Section 7.2 page 188
  • Workers "Go in Action" Section 7.3 page 198

Conventions and Idioms