mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
rebase: bump github.com/google/fscrypt from 0.3.3 to 0.3.4
Bumps [github.com/google/fscrypt](https://github.com/google/fscrypt) from 0.3.3 to 0.3.4. - [Release notes](https://github.com/google/fscrypt/releases) - [Changelog](https://github.com/google/fscrypt/blob/master/NEWS.md) - [Commits](https://github.com/google/fscrypt/compare/v0.3.3...v0.3.4) --- updated-dependencies: - dependency-name: github.com/google/fscrypt dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
committed by
mergify[bot]
parent
991c21f7fd
commit
f84d43c6d1
36
vendor/github.com/google/fscrypt/metadata/config.go
generated
vendored
36
vendor/github.com/google/fscrypt/metadata/config.go
generated
vendored
@ -29,31 +29,39 @@ package metadata
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/golang/protobuf/jsonpb"
|
||||
"google.golang.org/protobuf/encoding/protojson"
|
||||
)
|
||||
|
||||
// WriteConfig outputs the Config data as nicely formatted JSON
|
||||
func WriteConfig(config *Config, out io.Writer) error {
|
||||
m := jsonpb.Marshaler{
|
||||
EmitDefaults: true,
|
||||
EnumsAsInts: false,
|
||||
Indent: "\t",
|
||||
OrigName: true,
|
||||
m := protojson.MarshalOptions{
|
||||
Multiline: true,
|
||||
Indent: "\t",
|
||||
UseProtoNames: true,
|
||||
UseEnumNumbers: false,
|
||||
EmitUnpopulated: true,
|
||||
}
|
||||
if err := m.Marshal(out, config); err != nil {
|
||||
bytes, err := m.Marshal(config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
_, err := out.Write([]byte{'\n'})
|
||||
if _, err = out.Write(bytes); err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = out.Write([]byte{'\n'})
|
||||
return err
|
||||
}
|
||||
|
||||
// ReadConfig writes the JSON data into the config structure
|
||||
func ReadConfig(in io.Reader) (*Config, error) {
|
||||
config := new(Config)
|
||||
// Allow (and ignore) unknown fields for forwards compatibility.
|
||||
u := jsonpb.Unmarshaler{
|
||||
AllowUnknownFields: true,
|
||||
bytes, err := io.ReadAll(in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return config, u.Unmarshal(in, config)
|
||||
config := new(Config)
|
||||
// Discard unknown fields for forwards compatibility.
|
||||
u := protojson.UnmarshalOptions{
|
||||
DiscardUnknown: true,
|
||||
}
|
||||
return config, u.Unmarshal(bytes, config)
|
||||
}
|
||||
|
Reference in New Issue
Block a user