Recently started seriously (I mean serious) with the go language and joined the 42 zone ^_

Source: Internet
Author: User
Tags sprintf
This is a creation in Article, where the information may have evolved or changed.

Generally everyone is to look at http://golang.org/article even, but the real coder to practice coding to find confidence.

So we downloaded the goscript on the https://github.com/andrebq/goscript and corrected it to make it

Implement the correct parameter pass, and do not use that disgusting comment implementation, save every time the editor prompts the file to be modified.

The key implementation is a function called ISource (), which replaces Goscript's original comment ():

Func isource (DST, src string) {file1, err: = OS. Open (SRC, os. O_rdonly, 0) if err! = Nil {error (FMT. Sprintf ("Can ' t open%s", SRC))} defer file1. Close () OS. Remove (DST) file2, err: = OS. Open (DST, os. o_wronly | Os. O_creat, 0644) if err! = Nil {error (FMT. Sprintf ("Can ' t open%s", flag.) Args () [1])} defer file2. Close () BufFile1: = Bufio. Newreader (file1) BufFile2: = Bufio. Newwriter (file2) defer Buffile2.flush () head, _: = Buffile1.readstring ('/n ') If Len (head) >= 2 && head [0:2]! = "#!" {//error ("First line:" + head) buffile2.writestring (head + "/n")} io. Copy (BufFile2, BufFile1)}

Further, I found that none of the tag generation tools on the Golang home page can be compiled on the latest version of Go, but will again use the powerful ctags regex syntax:

#!/bin/shctags--exclude=*_test.go--langdef=go--langmap=go:.go--regex-go= "/^func//([^)]+//)/s+ (/w+)//1/i"-- Regex-go= "/^func/s+ (/w+)//1/i"-re $*

Go and Emacs are just one of the 42-zone labels.

Welcome to communicate together.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.