This is a creation in Article, where the information may have evolved or changed.
package main import ("FMT" "Bufio" "IO" "OS" "Flag" "StrConv")// define a struct body type readwrite struct {In *stringOut *string}// Define initialization Method func (Rw *readwrite) init ()  {RW. In = flag. String ("In", ' in ', "in") RW. Out = flag. String ("Out", ' out ', "out") flag. Parse ()}// defines a method for reading a file func (rw *readwrite) read () (result []int, err Error) {file, err1 := os. Open (* (rw. IN) if nil != err1 {panic ("Error to open file ...")}defer file. Close () Br := bufio. Newreader (file) result = make ([]int, 0) for {line, isprefix, err2 := br. ReadLine () If nil != err2 {if io. Eof == err2 {fmt. Println ("FINISH READ  ...")}break}if isprefix {return}str := string (line) value, err3 := strconv. Atoi (str) if nil ! = err3 {err = err3return}result = append (Result, value)}return}// Defines methods for writing files func (rw *readwrite) write (value []int) {file, err := os. Create (* (rw. Out)) if nil != err {panic ("Error to create file ...")}defer file. Close () For index, res := range value {str := strconv. Itoa (res*index) file. WriteString (str + "\ n")}}func main () {defer func () {if ex:=recover (); ex!= Nil {fmt. Println (Ex)}} () Rw := new (ReadWrite) rw. Init () value, err := rw. Read () if nil != err {panic ("Error ...")}rw. Write (Value)}