File tree 5 files changed +96
-0
lines changed
5 files changed +96
-0
lines changed Original file line number Diff line number Diff line change @@ -126,6 +126,8 @@ This guide full of examples is intended for people learning Go that are coming f
126
126
- [ sha256] ( #crypto )
127
127
- [ env vars] ( #env-vars )
128
128
- [ cli args] ( #cli-args )
129
+ - [ stdout] ( #stdout )
130
+ - [ stderr] ( #stderr )
129
131
- [ stdin] ( #stdin )
130
132
- [ modules] ( #modules )
131
133
- [ stack trace] ( #stack-trace )
@@ -3103,6 +3105,78 @@ $ go run examples/cli_args.go foo bar qux
3103
3105
[foo bar qux]
3104
3106
` ` `
3105
3107
3108
+ # ## stdout
3109
+ ---
3110
+
3111
+ # ### Node.js
3112
+
3113
+ ` ` ` node
3114
+ process.stdout.write(' hello world\n' )
3115
+ ` ` `
3116
+
3117
+ Output
3118
+
3119
+ ` ` ` bash
3120
+ hello world
3121
+ ` ` `
3122
+
3123
+ # ### Go
3124
+
3125
+ ` ` ` go
3126
+ package main
3127
+
3128
+ import (
3129
+ " fmt"
3130
+ " os"
3131
+ )
3132
+
3133
+ func main () {
3134
+ fmt.Fprint(os.Stdout, " hello world\n" )
3135
+ }
3136
+ ` ` `
3137
+
3138
+ Output
3139
+
3140
+ ` ` ` bash
3141
+ hello world
3142
+ ` ` `
3143
+
3144
+ # ## stderr
3145
+ ---
3146
+
3147
+ # ### Node.js
3148
+
3149
+ ` ` ` node
3150
+ process.stderr.write(' hello error\n' )
3151
+ ` ` `
3152
+
3153
+ Output
3154
+
3155
+ ` ` ` bash
3156
+ hello error
3157
+ ` ` `
3158
+
3159
+ # ### Go
3160
+
3161
+ ` ` ` go
3162
+ package main
3163
+
3164
+ import (
3165
+ " fmt"
3166
+ " os"
3167
+ )
3168
+
3169
+ func main () {
3170
+ fmt.Fprint(os.Stdout, " hello error\n" )
3171
+ }
3172
+ ` ` `
3173
+
3174
+ Output
3175
+
3176
+ ` ` ` bash
3177
+ hello error
3178
+ ` ` `
3179
+
3106
3180
# ## stdin
3107
3181
---
3108
3182
Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ "fmt"
5
+ "os"
6
+ )
7
+
8
+ func main () {
9
+ fmt .Fprint (os .Stdout , "hello error\n " )
10
+ }
Original file line number Diff line number Diff line change
1
+ process . stderr . write ( 'hello error\n' )
Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ "fmt"
5
+ "os"
6
+ )
7
+
8
+ func main () {
9
+ fmt .Fprint (os .Stdout , "hello world\n " )
10
+ }
Original file line number Diff line number Diff line change
1
+ process . stdout . write ( 'hello world\n' )
You can’t perform that action at this time.
0 commit comments