Top 0.6% dependent packages on proxy.golang.org
Top 0.7% dependent repos on proxy.golang.org
Top 9.0% forks on proxy.golang.org
Top 1.7% docker downloads on proxy.golang.org
proxy.golang.org : github.com/reiver/go-oi
Package oi provides useful tools to be used with Go's standard "io" package. For example, did you know that when you call the Write method on something that fits the io.Writer interface, that it is possible that not everything was be written?! I.e., that a 'short write' happened. That just doing the following is (in general) not enough: That, for example, you should be checking if "err == io.ErrShortWrite", and then maybe calling the Write method again but only with what didn't get written. For a simple example of this (that actually is not sufficient to solve this problem, but illustrates the direction you would need to go to solve this problem is): Note that the second call to the Write method passed "p[n:]" (instead of just "p"), to account for the "n" bytes already being written (with the first call to the `Write` method). A more "production quality" version of this would likely be in a loop, but such that that the loop had "guards" against looping forever, and also possibly looping for "too long". Well package oi provides tools that helps you deal with this and other problems. For example, you can handle a 'short write' with the following oi func: ``` n, err := oi.LongWrite(writer, p) ```
Registry
-
Source
- Documentation
- JSON
purl: pkg:golang/github.com/reiver/go-oi
License: MIT
Latest release: about 9 years ago
First release: about 9 years ago
Namespace: github.com/reiver
Dependent packages: 68
Dependent repositories: 75
Stars: 7 on GitHub
Forks: 4 on GitHub
Docker dependents: 3
Docker downloads: 1,047,945
See more repository details: repos.ecosyste.ms
Last synced: 4 days ago