Example #1
0
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)
}
Example #2
0
func main() {
	// parse and handle options
	opts.Parse()
	if *showVersion {
		ShowVersion()
		os.Exit(0)
	}
}
Example #3
0
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}
`)
}
Example #4
0
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}")
}
Example #5
0
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()
}