packageconcatimport("io/ioutil""os""path/filepath""strings")funcConcatenateJS(dirPathstring)[]byte{varjs_code[]byte// walk all files in directoryfilepath.Walk(dirPath,func(pathstring,infoos.FileInfo,errerror)error{if!info.IsDir()&&strings.HasSuffix(info.Name(),".js"){println("concatenating "+path+" ...")b,err:=ioutil.ReadFile(path)iferr!=nil{returnerr}js_code=append(js_code,b...)}returnnil})returnjs_code}