×

Golang Tutorial

Golang Reference

Golang Programs

Golang Practice

Golang Miscellaneous

Golang bytes.MinRead Constant with Examples

Golang | bytes.MinRead Constant: Here, we are going to learn about the MinRead constant of the bytes package with its usages, syntax, and examples.
Submitted by IncludeHelp, on September 21, 2021

bytes.MinRead Constant

The MinRead constant is an inbuilt constant of the bytes package which is used to get the minimum slice size passed to a Read call by Buffer.ReadFrom. The value of the MinRead constant is 512.

Syntax

int bytes.MinRead

Parameters

  • None

Return Value

The return type of the bytes.MinRead constant is an int, it returns the minimum slice size passed to a Read call by Buffer.ReadFrom.

Example 1

// Golang program to demonstrate the
// example of bytes.MinRead constant

package main

import (
	"bytes"
	"fmt"
)

func main() {
	fmt.Println("Value of bytes.MinRead:", bytes.MinRead)
	fmt.Printf("Type of bytes.MinRead: %T\n", bytes.MinRead)
}

Output:

Value of bytes.MinRead: 512
Type of bytes.MinRead: int

Example 2

// Golang program to demonstrate the
// example of bytes.MinRead constant

package main

import (
	"bytes"
	"fmt"
)

// creating function to return the
// value of MinRead.
func getMinRead() int {
	return bytes.MinRead
}

func main() {
	fmt.Println("Value of bytes.MinRead:", getMinRead())
}

Output:

Value of bytes.MinRead: 512

Golang bytes Package »




Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.