示例#1
0
文件: main.go 项目: bytbox/obsidian
func main() {
	// option setup
	opts.Description = "lightweight http blog server"
	// parse and handle options
	opts.Parse()

	confFile = path.Join(*blogroot, "config")
	templateDir = path.Join(*blogroot, "templates")
	postDir = path.Join(*blogroot, "posts")
	pageDir = path.Join(*blogroot, "pages")
	dataDir = path.Join(*blogroot, "data")

	config.ReadConfig(confFile)
	input.ReadTemplates(templateDir)
	input.ReadPosts(postDir)
	input.ReadPages(pageDir)
	input.ReadData(dataDir)
	makeTags()
	makeCategories()
	compile.CompileAll()
	serve.StartServers()
	log.Stdout("Server started in ",
		(time.Nanoseconds()-startTime)/1000,
		" microseconds")
	serve.Serve(*port)
}
示例#2
0
文件: gomake.go 项目: bytbox/gomake
func main() {
	// parse and handle options
	opts.Parse()
	if *showVersion {
		ShowVersion()
		os.Exit(0)
	}
}
示例#3
0
文件: gorules.go 项目: bytbox/gomake
func main() {
	// parse and handle options
	opts.Parse()
	if *showVersion {
		ShowVersion()
		os.Exit(0)
	}
	PrintAutoNotice()
	fmt.Print(
		`
.go.${O}:
        ${GC} $*.go

.go.a:
        ${GC} -o $*.${O} $*.go && gopack grc $*.a $*.${O}

format:
        gofmt -w ${GOFILES}
`)
}
示例#4
0
文件: goinfo.go 项目: bytbox/gomake
func main() {
	// parse and handle options
	opts.Parse()
	if *showVersion {
		ShowVersion()
		os.Exit(0)
	}
	// if there are no files, generate a list
	if len(opts.Args) == 0 {
		path.Walk(".", GoFileFinder{}, nil)
	} else {
		for _, fname := range opts.Args {
			files.Push(fname)
		}
	}
	GetPackageList()
	PrintAutoNotice()
	PrintFList()
	PrintPList()
	fmt.Println("GOPACKAGES = ${GOPKGS:=.${O}}")
	fmt.Println("GOARCHIVES = ${GOPKGS:=.a}")
}
示例#5
0
文件: godep.go 项目: alberts/gomake
func main() {
	opts.Usage = "[file1.go [...]]"
	opts.Description =
		`construct and print a dependency tree for the given source files.`
		// parse and handle options
	opts.Parse()
	if *showVersion {
		ShowVersion()
		os.Exit(0)
	}
	// if there are no files, generate a list
	if len(opts.Args) == 0 {
		filepath.Walk(".", GoFileFinder{}, nil)
	} else {
		for _, fname := range opts.Args {
			files.Push(fname)
		}
	}
	// for each file, list dependencies
	for _, fname := range files {
		fset := token.NewFileSet()
		file, err := parser.ParseFile(fset, fname, nil, parser.ImportsOnly)
		if err != nil {
			fmt.Fprintf(os.Stderr, "%s\n", err)
			os.Exit(1)
		}
		HandleFile(fname, file)
	}
	PrintAutoNotice()
	FindMain()
	if *showNeeded {
		PrintNeeded(".EXTERNAL: ", ".a")
	}
	// in any case, print as a comment
	PrintNeeded("# external packages: ", "")
	PrintDeps()
}