• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang flag.Float64函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中flag.Float64函数的典型用法代码示例。如果您正苦于以下问题:Golang Float64函数的具体用法?Golang Float64怎么用?Golang Float64使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Float64函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: main

func main() {
	maxSideLength := flag.Float64("max", 1, "maximum side length")
	minSideLength := flag.Float64("min", 1, "minimum side length")
	flag.Parse()

	cuboidStream := make(chan Cuboid, NUM_CONCURRENT_CUBOID_SEARCHES)
	perfectCuboid := make(chan Cuboid)
	wg := new(sync.WaitGroup)

	go waitForPerfectCuboid(perfectCuboid)
	go distributeCuboids(cuboidStream, perfectCuboid, wg)

	fmt.Printf("Searching for a perfect cuboid with side lengths between %d and %d...", int(*minSideLength), int(*maxSideLength))

	x := 1.0
	for x <= *maxSideLength {
		y := 1.0
		for y <= *maxSideLength {
			z := 1.0
			for z <= *maxSideLength {
				if x >= *minSideLength || y >= *minSideLength || z >= *minSideLength {
					wg.Add(1)
					cuboid := Cuboid{Length: x, Width: y, Height: z}
					cuboidStream <- cuboid
				}
				z += 1
			}
			y += 1
		}
		x += 1
	}

	wg.Wait()
	fmt.Println(" done.")
}
开发者ID:kochman,项目名称:perfectcuboid,代码行数:35,代码来源:perfectcuboid.go


示例2: main

func main() {
	debug := flag.Bool("debug", false, "debug on")
	threaded := flag.Bool("threaded", true, "debug on")
	delcache_ttl := flag.Float64("deletion_cache_ttl", 5.0, "Deletion cache TTL in seconds.")
	branchcache_ttl := flag.Float64("branchcache_ttl", 5.0, "Branch cache TTL in seconds.")
	deldirname := flag.String(
		"deletion_dirname", "GOUNIONFS_DELETIONS", "Directory name to use for deletions.")
	flag.Parse()

	if len(flag.Args()) < 2 {
		fmt.Println("Usage:\n  main MOUNTPOINT RW-DIRECTORY RO-DIRECTORY ...")
		os.Exit(2)
	}

	ufsOptions := unionfs.UnionFsOptions{
		DeletionCacheTTLSecs: *delcache_ttl,
		BranchCacheTTLSecs:   *branchcache_ttl,
		DeletionDirName:      *deldirname,
	}

	ufs, err := unionfs.NewUnionFsFromRoots(flag.Args()[1:], &ufsOptions)
	if err != nil {
		log.Fatal("Cannot create UnionFs", err)
		os.Exit(1)
	}
	mountState, _, err := fuse.MountFileSystem(flag.Arg(0), ufs, nil)
	if err != nil {
		log.Fatal("Mount fail:", err)
	}

	mountState.Debug = *debug
	mountState.Loop(*threaded)
}
开发者ID:jravasi,项目名称:go-fuse,代码行数:33,代码来源:main.go


示例3: main

func main() {

	// Set up flags.
	wFlag := flag.Int("w", 640, "width of the image in pixels")
	hFlag := flag.Int("h", 480, "height of the image in pixels")
	xMinFlag := flag.Float64("x-min", -2.0, "minimum x value to plot")
	xMaxFlag := flag.Float64("x-max", 2.0, "maximum x value to plot")
	bailoutFlag := flag.Int("bailout", 100, "maximum iteration bailout")

	// Handle the flags.
	flag.Parse()

	// Main logic.
	acc := newAccumulator(*wFlag, *hFlag, *xMinFlag, *xMaxFlag)
	const numSamples = 1e8
	for acc.getCount() < numSamples {
		log.Print(acc.getCount())
		accumulateSeqence(*bailoutFlag, acc)
	}

	img := acc.toImage()
	f, err := os.Create("out.png")
	if err != nil {
		log.Fatal(err)
	}
	if err := png.Encode(f, img); err != nil {
		log.Fatal(err)
	}
}
开发者ID:peterstace,项目名称:buddhabrotgen,代码行数:29,代码来源:main.go


示例4: main

func main() {
	drinks := flag.Float64("drinks", 2.5, "How many drinks consumed")
	weight := flag.Float64("weight", 70.0, "Body weight in kilograms")
	hours := flag.Float64("hours", 2.0, "How many hours it took to drink")
	gender := flag.String("gender", "male", "Specify male or female")

	flag.Usage = func() {
		fmt.Println(`
  NAME:

    inebriati

  DESCRIPTION:

    Calculates estimated blood ethanol concentration (EBAC) 

  COMMANDS:

    -drinks              Number of standard drinks comsumed.
    -weight              Weight in kiligrams.
    -hours               Drinking period in hours.
    -gender              Select male or female.
`[1:])
	}

	flag.Parse()

	i := inebriati.New(*drinks, *weight, *hours, *gender)
	i.Calc()

	fmt.Println(i)
}
开发者ID:NovemberFoxtrot,项目名称:inebriati,代码行数:32,代码来源:tippler.go


示例5: main

func main() {
	size := flag.Int("psize", 500, "physical size of the square image")
	vpx := flag.Float64("x", 0, "x coordinate of the center of the image")
	vpy := flag.Float64("y", 0, "y coordinate of the center of the image")
	d := flag.Float64("size", 2, "size of the represented part of the plane")
	filename := flag.String("name", "image", "name of the image file produced (w/o extension")
	numberOfProcs := flag.Int("procs", 2, "number of procs to use")
	seed := flag.Int64("seed", 42, "seed for the random number generator")
	cols := flag.Bool("with-colors", false, "whether there is colors")

	flag.Parse()

	runtime.GOMAXPROCS(*numberOfProcs)

	withColors = *cols
	if *cols {
		initColors(*seed)
	}

	file, err := os.Open(*filename+".png", os.O_RDWR|os.O_CREAT, 0666)
	if err != nil {
		panic("error with opening file \"" + *filename + "\"")
	}

	im := image.NewRGBA(*size, *size)

	ch := make(chan point, 1000)

	Start(im, 2, *vpx, *vpy, *d, ch)

	handleChans(im, ch)

	png.Encode(file, im)
}
开发者ID:ineol,项目名称:mandelgo,代码行数:34,代码来源:mandel.go


示例6: handleAddConsumer

func handleAddConsumer() error {
	id := stripArgument()
	if id == "" {
		return errors.New("No task id supplied to add")
	}
	var (
		api = flag.String("api", "", "API host:port")
		cpu = flag.Float64("cpu", 0.1, "CPUs per task")
		mem = flag.Float64("mem", 128, "Mem per task")
	)
	ParseFlags("add")
	if err := resolveApi(*api); err != nil {
		return err
	}

	if *executor == "" {
		return errors.New("Executor name required")
	}

	request := framework.NewApiRequest(framework.Config.Api + "/api/add")
	request.PutString("type", framework.TaskTypeConsumer)
	request.PutString("id", id)
	request.PutFloat("cpu", *cpu)
	request.PutFloat("mem", *mem)
	request.PutString("executor", *executor)

	response := request.Get()

	fmt.Println(response.Message)

	return nil
}
开发者ID:elodina,项目名称:go-kafka-client-mesos,代码行数:32,代码来源:cli.go


示例7: main

func main() {
	diameter := flag.Float64("d", 9.0, "beam diameter in millimetres")
	power := flag.Float64("p", 1.0, "laser power in watts")
	flag.Parse()

	if *diameter <= 0.0 {
		fmt.Println("Beam diameter must be a positive number greater than zero.")
		return
	}

	*diameter /= 1000.0 // convert mm to m
	ba := beamArea(*diameter)
	pd := powerDensity(ba, *power)
	od := opticalDensity(pd)
	fmt.Printf("Beam area: %f m^2\nPower density: %f W/m^2\n", ba, pd)
	if od == -1 {
		fmt.Println("Couldn't determine the appropriate optical density rating.")
		fmt.Println("Please consult EN207 for the appopriate PPE.")
	} else if od == 11 {
		fmt.Printf("Your optical density requirements are above the ")
		fmt.Printf("standard requirements. Please consult EN207.\n")
	} else {
		fmt.Printf("Based on your laser's power and beam diameter, ")
		fmt.Printf("you should use eyewear with an OD of %d.\n", od)
	}
}
开发者ID:kisom,项目名称:laserod,代码行数:26,代码来源:od.go


示例8: main

func main() {

	var data = flag.String("data", "", "The data directory where WOF data lives, required")
	var cache_size = flag.Int("cache_size", 1024, "The number of WOF records with large geometries to cache")
	var cache_trigger = flag.Int("cache_trigger", 2000, "The minimum number of coordinates in a WOF record that will trigger caching")

	var lat = flag.Float64("latitude", 0.0, "")
	var lon = flag.Float64("longitude", 0.0, "")

	var loglevel = flag.String("loglevel", "info", "...")

	flag.Parse()

	logger := log.NewWOFLogger("[wof-breaches] ")
	logger.AddLogger(os.Stdout, *loglevel)

	idx, _ := rtree.NewIndex(*data, *cache_size, *cache_trigger, logger)

	for _, path := range flag.Args() {

		logger.Info("indexing %s", path)
		idx.IndexGeoJSONFile(path)
	}

	results := idx.GetIntersectsByLatLon(*lat, *lon)
	inflated := idx.InflateSpatialResults(results)

	for _, r := range inflated {
		logger.Info("%v", r)
	}
}
开发者ID:whosonfirst,项目名称:go-whosonfirst-rtree,代码行数:31,代码来源:wof-rtree-pip.go


示例9: main

func main() {
	// do the actual parsing
	flag.Var(&listenersFlag, "l", "Which ports to listen on")
	flag.Var(&connectorsFlag, "c", "Which addresses to try to connect to")
	flag.BoolVar(&infoptr, "v", false, "Turn on verbose mode")
	flag.BoolVar(&debugptr, "vv", false, "Turn on extra verbose mode")
	retryPeriod = time.Duration(1000 * (*flag.Float64("rp", 5.0,
		"Retry rate for double connections")))
	connPeriod = time.Duration(1000 * (*flag.Float64("cp", 0.5,
		"Retry rate for double connections, on success")))
	flag.Parse()

	debug("Number of listeners: " + fmt.Sprint(len(listenersFlag)))
	debug("Number of connectors: " + fmt.Sprint(len(connectorsFlag)))
	// check a possibly temporary condition
	if len(listenersFlag)+len(connectorsFlag) != 2 {
		errmsg(1, "Strictly 2 connections allowed")
	}

	if len(listenersFlag) == 1 && len(connectorsFlag) == 1 {
		listenOne(normalizeAddr(listenersFlag[0]),
			normalizeAddr(connectorsFlag[0]))
	}
	if len(listenersFlag) == 2 && len(connectorsFlag) == 0 {
		listenTwo(normalizeAddr(listenersFlag[0]),
			normalizeAddr(listenersFlag[1]))
	}
	if len(listenersFlag) == 0 && len(connectorsFlag) == 2 {
		connectTwo(normalizeAddr(connectorsFlag[0]),
			normalizeAddr(connectorsFlag[1]))
	}
}
开发者ID:thenoviceoof,项目名称:proxybfs,代码行数:32,代码来源:proxybfs.go


示例10: main

func main() {
	count := flag.Int("count", 5, "The number of pings to send")
	wait := flag.Float64("wait", 15, "The amount of time to wait for all pings to come back in seconds")
	interval := flag.Float64("interval", 2, "The interval to wait between pings in seconds")
	repeat := flag.Int("repeat", 30, "Repeat the whole process every x seconds")
	socket := flag.String("socket", "/tmp/ping-monitor.sock", "Unix socket to create/listen on")

	flag.Parse()

	if len(flag.Args()) < 1 {
		os.Stderr.WriteString("Must supply at least one IP address!\n")
		os.Exit(1)
	}

	h := &httpmetrics.Handler{
		Socket:     *socket,
		Registries: make(map[string]*metrics.Registry),
	}

	pi := &PingInfo{
		Count:      *count,
		Wait:       *wait,
		Interval:   *interval,
		Repeat:     *repeat,
		Hosts:      flag.Args(),
		Registries: &(h.Registries),
	}

	InitPing(pi)

	if err := h.CreateServer(); err != nil {
		panic(err)
	}
}
开发者ID:mehulsbhatt,项目名称:gollector-monitors,代码行数:34,代码来源:main.go


示例11: TestParse_Global

func TestParse_Global(t *testing.T) {
	resetForTesting("")

	os.Setenv(envTestPrefix+"D", "EnvD")
	os.Setenv(envTestPrefix+"E", "true")
	os.Setenv(envTestPrefix+"F", "5.5")

	flagA := flag.Bool("a", false, "")
	flagB := flag.Float64("b", 0.0, "")
	flagC := flag.String("c", "", "")

	flagD := flag.String("d", "", "")
	flagE := flag.Bool("e", false, "")
	flagF := flag.Float64("f", 0.0, "")

	parse(t, "./testdata/global.ini", envTestPrefix)
	if !*flagA {
		t.Errorf("flagA found %v, expected true", *flagA)
	}
	if *flagB != 5.6 {
		t.Errorf("flagB found %v, expected 5.6", *flagB)
	}
	if *flagC != "Hello world" {
		t.Errorf("flagC found %v, expected 'Hello world'", *flagC)
	}
	if *flagD != "EnvD" {
		t.Errorf("flagD found %v, expected 'EnvD'", *flagD)
	}
	if !*flagE {
		t.Errorf("flagE found %v, expected true", *flagE)
	}
	if *flagF != 5.5 {
		t.Errorf("flagF found %v, expected 5.5", *flagF)
	}
}
开发者ID:ngdinhtoan,项目名称:globalconf,代码行数:35,代码来源:globalconf_test.go


示例12: main

func main() {

	lat := flag.Float64("lat", 0, "latitude of occurrence")
	lng := flag.Float64("lng", 0, "longitude of occurrence")
	explain := flag.Bool("explain", true, "print useful information")
	date := flag.Int64("date", 0, "unix second: 1467558491")
	period := flag.Int64("period", 14, "number of days into the past to generate weather: 14")

	flag.Parse()

	store, err := noaa.NewWeatherStore(
		"/Users/mph/Desktop/phenograph-raw-data/stations.txt",
		"/Users/mph/Desktop/phenograph-raw-data/ghcnd_all/ghcnd_all",
		false,
	)
	if err != nil {
		panic(err)
	}

	records, err := store.Nearest(
		*lat,
		*lng,
		noaa.Elements{noaa.ElementTMAX, noaa.ElementPRCP, noaa.ElementTMIN},
		noaa.TimesFromUnixArray(*date, *period),
		*explain,
	)
	if err != nil {
		panic(err)
	}

	fmt.Println("RECORDS", utils.JsonOrSpew(records))

	return
}
开发者ID:heindl,项目名称:raincollector,代码行数:34,代码来源:main.go


示例13: decodeRefArg

func decodeRefArg(name, typeName string) (interface{}, error) {
	switch strings.ToLower(typeName) {
	case "*bool":
		newValue := flag.Bool(name, app.DefaultBoolValue, name)
		return newValue, nil
	case "bool":
		newValue := flag.Bool(name, app.DefaultBoolValue, name)
		return *newValue, nil

	case "*string":
		newValue := flag.String(name, app.DefaultStringValue, name)
		return *newValue, nil
	case "string":
		newValue := flag.String(name, app.DefaultStringValue, name)
		return *newValue, nil

	case "*time.duration":
		newValue := flag.Duration(name, app.DefaultDurationValue, name)
		return *newValue, nil
	case "time.duration":
		newValue := flag.Duration(name, app.DefaultDurationValue, name)
		return *newValue, nil

	case "*float64":
		newValue := flag.Float64(name, app.DefaultFloat64Value, name)
		return *newValue, nil
	case "float64":
		newValue := flag.Float64(name, app.DefaultFloat64Value, name)
		return *newValue, nil

	case "*int":
		newValue := flag.Int(name, app.DefaultIntValue, name)
		return *newValue, nil
	case "int":
		newValue := flag.Int(name, app.DefaultIntValue, name)
		return *newValue, nil

	case "*int64":
		newValue := flag.Int64(name, app.DefaultInt64Value, name)
		return *newValue, nil
	case "int64":
		newValue := flag.Int64(name, app.DefaultInt64Value, name)
		return *newValue, nil

	case "*uint":
		newValue := flag.Uint(name, app.DefaultUIntValue, name)
		return *newValue, nil
	case "uint":
		newValue := flag.Uint(name, app.DefaultUIntValue, name)
		return *newValue, nil

	case "*uint64":
		newValue := flag.Uint64(name, app.DefaultUInt64Value, name)
		return *newValue, nil
	case "uint64":
		newValue := flag.Uint64(name, app.DefaultUInt64Value, name)
		return *newValue, nil
	}
	return nil, fmt.Errorf("unknow type %s for argument %s", typeName, name)
}
开发者ID:goatcms,项目名称:goat-core,代码行数:60,代码来源:injector.go


示例14: main

func main() {
	var seq_file = flag.String("s", "", "Specify a file containing the sequence.")
	var rl = flag.Int("l", 100, "Read length.")
	var coverage = flag.Float64("c", 2.0, "Coverage")
	var error_rate = flag.Float64("e", 0.01, "Error rate.")
	flag.BoolVar(&Debug, "debug", false, "Turn on debug mode.")
	flag.Parse()
	read_len := int(*rl)
	if *seq_file != "" {
		if *coverage > 0 && read_len > 0 {
			idx := fmi.New(*seq_file)
			num_of_reads := int(*coverage * float64(idx.LEN) / float64(read_len))
			read_indices := make([]int, num_of_reads)
			the_read := make([]byte, read_len)
			var rand_pos int

			for i := 0; i < num_of_reads; i++ {
				rand_pos = int(rand_gen.Intn(int(idx.LEN - read_len)))
				if justN(rand_pos, int(read_len)) {
					i--
					continue
				}

				read_indices = idx.Repeat(rand_pos, read_len)
				var errors []int
				if int(rand_pos+read_len) >= len(fmi.SEQ) {
					panic("Read may be shorter than wanted.")
				}

				copy(the_read, fmi.SEQ[rand_pos:rand_pos+read_len])
				for k := 0; k < len(the_read); k++ {
					if rand_gen.Float64() < *error_rate {
						the_read[k] = random_error(the_read[k])
						errors = append(errors, k)
					}
				}
				if Debug {
					for j := 0; j < int(rand_pos); j++ {
						fmt.Printf(" ")
					}
				}
				fmt.Printf("%s %d ", the_read, len(read_indices))
				for j := 0; j < len(read_indices); j++ {
					fmt.Printf("%d ", read_indices[j])
				}
				fmt.Printf("%d", len(errors))
				for j := 0; j < len(errors); j++ {
					fmt.Printf(" %d", errors[j])
				}
				fmt.Println()
			}
		} else {
			idx := fmi.New(*seq_file)
			idx.Save(*seq_file)
		}
	} else {
		fmt.Println("Must provide sequence file")
	}
}
开发者ID:vtphan,项目名称:fmi,代码行数:59,代码来源:generate_reads.go


示例15: main

func main() {
	var ohms = flag.Float64("r", 0, "ohms")
	var watts = flag.Float64("w", 0, "watts")
	var amps = flag.Float64("a", 0, "amps")
	var volts = flag.Float64("v", 0, "volts")
	flag.Parse()
	fmt.Printf("O: %f\tW: %f\tA: %f\tV: %f\n", *ohms, *watts, *amps, *volts)
}
开发者ID:mkandel,项目名称:playing_with_go,代码行数:8,代码来源:ohms_law.go


示例16: init

func init() {

	img_width = flag.Int("w", 1280, "The width of the resulting image.")
	img_height = flag.Int("h", 800, "The height of the resulting image.")
	mset_x_ctr = flag.Float64("x", -0.75, "The center of the image with respect to the x-axis of the Mandelbrot Set, between -2.5 and 1.")
	mset_y_ctr = flag.Float64("y", 0, "The center of the image with respect to the y-axis of the Mandelbrot Set, between -1 and 1.")
	zoom = flag.Float64("z", 1, "Zoom factor.")
	max_iterations = flag.Int64("i", 1000, "The number of iterations to perform before considering a coordinate going to infinity.")
}
开发者ID:jackmanlabs,项目名称:mandelbrot,代码行数:9,代码来源:main.go


示例17: parseFlags

func parseFlags() (load, blockSize *float64, numBlocks, numIterations *int64) {
	load = flag.Float64("load", 0.0, "load percentage")
	blockSize = flag.Float64("bs", bls.DEFAULT_BLOCK_SIZE, "block size")
	numBlocks = flag.Int64("nb", bls.DEFAULT_NUM_BLOCKS, "number of blocks")
	numIterations = flag.Int64("ni", bls.DEFAULT_NUM_ITERATIONS, "number of iterations")

	flag.Parse()
	return
}
开发者ID:cfromknecht,项目名称:bitcoin_load_spike,代码行数:9,代码来源:main.go


示例18: main

func main() {
	var (
		width        = flag.Int("w", 1024, "width")
		top          = flag.Int("top", 50, "top")
		left         = flag.Int("left", 100, "left margin")
		vp           = flag.Int("vp", 512, "visualization point")
		vw           = flag.Int("vw", 300, "visual area width")
		bh           = flag.Int("bh", 20, "bar height")
		smax         = flag.Float64("sm", 10, "maximum speedup")
		dmax         = flag.Float64("dm", 100, "maximum delta")
		title        = flag.String("title", "", "title")
		speedcolor   = flag.String("scolor", "green", "speedup color")
		regresscolor = flag.String("rcolor", "red", "regression color")
		style        = flag.String("style", "bar", "set the style (bar or inline)")
		lines        = flag.Bool("line", false, "show lines between entries")
		coldata      = flag.Bool("col", false, "show data in a single column")
	)
	flag.Parse()

	g := geometry{
		width:      *width,
		top:        *top,
		left:       *left,
		vp:         *vp,
		vwidth:     *vw,
		barHeight:  *bh,
		title:      *title,
		scolor:     *speedcolor,
		rcolor:     *regresscolor,
		style:      *style,
		dolines:    *lines,
		coldata:    *coldata,
		speedupmax: *smax,
		deltamax:   *dmax,
	}

	// For every named file or stdin, render the SVG in memory, accumulating the height.
	var b bytes.Buffer
	canvas := svg.New(&b)
	height := 0
	if len(flag.Args()) > 0 {
		for _, f := range flag.Args() {
			height = process(canvas, f, g)
			g.top = height + 50
		}
	} else {
		height = process(canvas, "", g)
	}
	g.height = height + 15

	// Write the rendered SVG to stdout
	out := svg.New(os.Stdout)
	out.Start(g.width, g.height)
	out.Rect(0, 0, g.width, g.height, "fill:white;stroke-width:2px;stroke:lightgray")
	b.WriteTo(os.Stdout)
	out.End()
}
开发者ID:dchapes,项目名称:svgo,代码行数:57,代码来源:benchviz.go


示例19: main

func main() {
	debug := flag.Bool("debug", false, "debug on")
	hardlinks := flag.Bool("hardlinks", false, "support hardlinks")
	delcache_ttl := flag.Float64("deletion_cache_ttl", 5.0, "Deletion cache TTL in seconds.")
	branchcache_ttl := flag.Float64("branchcache_ttl", 5.0, "Branch cache TTL in seconds.")
	deldirname := flag.String(
		"deletion_dirname", "GOUNIONFS_DELETIONS", "Directory name to use for deletions.")
	hide_readonly_link := flag.Bool("hide_readonly_link", true,
		"Hides READONLY link from the top mountpoints. "+
			"Enabled by default.")
	portableInodes := flag.Bool("portable-inodes", false,
		"Use sequential 32-bit inode numbers.")

	flag.Parse()

	if len(flag.Args()) < 2 {
		fmt.Println("Usage:\n  main MOUNTPOINT BASEDIR")
		os.Exit(2)
	}
	ufsOptions := unionfs.UnionFsOptions{
		DeletionCacheTTL: time.Duration(*delcache_ttl * float64(time.Second)),
		BranchCacheTTL:   time.Duration(*branchcache_ttl * float64(time.Second)),
		DeletionDirName:  *deldirname,
	}
	options := unionfs.AutoUnionFsOptions{
		UnionFsOptions: ufsOptions,
		Options: nodefs.Options{
			EntryTimeout:    time.Second,
			AttrTimeout:     time.Second,
			NegativeTimeout: time.Second,
			Owner:           fuse.CurrentOwner(),
		},
		UpdateOnMount: true,
		PathNodeFsOptions: pathfs.PathNodeFsOptions{
			ClientInodes: *hardlinks,
		},
		HideReadonly: *hide_readonly_link,
	}
	fsOpts := nodefs.Options{
		PortableInodes: *portableInodes,
	}
	gofs := unionfs.NewAutoUnionFs(flag.Arg(1), options)
	pathfs := pathfs.NewPathNodeFs(gofs, nil)
	state, conn, err := nodefs.MountRoot(flag.Arg(0), pathfs.Root(), &fsOpts)
	if err != nil {
		fmt.Printf("Mount fail: %v\n", err)
		os.Exit(1)
	}

	pathfs.SetDebug(*debug)
	conn.SetDebug(*debug)
	state.SetDebug(*debug)

	state.Serve()
	time.Sleep(1 * time.Second)
}
开发者ID:eliq,项目名称:go-fuse,代码行数:56,代码来源:main.go


示例20: main

func main() {
	var pv = flag.Float64("pv", 0, "Present Value")
	var r = flag.Float64("r", 0, "Interest Rate")
	var n = flag.Int("n", 0, "Number of periods")
	var c = flag.Bool("c", false, "Compounded Interest")
	var d = flag.Int("d", 4, "Digits after the decimal point")
	flag.Parse()
	f := F.Fee(*pv, *r, *n, *c)
	println(strconv.FormatFloat(f, 'f', *d, 64))
}
开发者ID:OpenVE,项目名称:scripts,代码行数:10,代码来源:GetFee.go



注:本文中的flag.Float64函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang flag.Float64Var函数代码示例发布时间:2022-05-24
下一篇:
Golang flag.DurationVar函数代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap