- Download Go for your platform from here
- Create a new directory and switch to it
- Download sand.go into it
- Run
$ go mod init main
this will create a file called go.mod that's needed for the next step - Run
$ go get ./...
this will pull down the packages needed to run the program - Run
$ go run sand.go
hit ESC to quit, or just close the window
A couple of code samples to show how a named pipe can be used to extend Go's channel paradigm for use between different processes running on a system.
- interprocess1.go details a single byte channel.
- interprocess2.go details a channel that passes slices of bytes.
Note that opening a write channel will return two channels -
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
/** | |
* Given a string expression, write a program to examine whether the pairs and the orders of | |
* "{", "}", "(", ")", "[", "]" are correct (all other chars are ignored). If they are correct, it is balanced. | |
* If balanced, just return "Balanced". | |
* If not balanced, return "Not Balanced: <problem-index>", where problem-index is the index of the first bracket | |
* that caused un-balancing. |