diff --git a/www/minio-client/Makefile b/www/minio-client/Makefile index 1fb4d1c4ddbe..0173313f34f1 100644 --- a/www/minio-client/Makefile +++ b/www/minio-client/Makefile @@ -1,115 +1,131 @@ PORTNAME= minio-client PORTVERSION= ${GH_TAGNAME:S/RELEASE.//:S/Z//:S/T/-/:S/-/./g} CATEGORIES= www MAINTAINER= jhixson@FreeBSD.org COMMENT= Replacement for ls, cp, mkdir, diff and rsync commands for filesystems LICENSE= APACHE20 BROKEN_i386= fails to build BUILD_DEPENDS= bash:shells/bash USES= go:modules OPTIONS_DEFINE= MC MC_DESC= Install as mc .include .if ${PORT_OPTIONS:MMC} MC= mc .else MC= ${PORTNAME} .endif USE_GITHUB= yes -GHTAG= RELEASE.2021-04-22T17-40-00Z -COMMIT_ID= 4eae7ec7ed254d425be1a72151f9a1f60707f273 +GHTAG= RELEASE.2021-05-26T19-19-26Z +COMMIT_ID= 8d65ee71302e662669bbbf57b834a4aa38c94bdc GH_TUPLE= minio:mc:${GHTAG}:DEFAULT \ + BurntSushi:toml:v0.3.1:burntsushi_toml/vendor/github.com/BurntSushi/toml \ StackExchange:wmi:cbe66965904d:stackexchange_wmi/vendor/github.com/StackExchange/wmi \ beorn7:perks:v1.0.1:beorn7_perks/vendor/github.com/beorn7/perks \ cespare:xxhash:v2.1.1:cespare_xxhash_v2/vendor/github.com/cespare/xxhash/v2 \ cheggaaa:pb:v1.0.29:cheggaaa_pb/vendor/github.com/cheggaaa/pb \ coreos:go-semver:v0.2.0:coreos_go_semver/vendor/github.com/coreos/go-semver \ coreos:go-systemd:39ca1b05acc7:coreos_go_systemd/vendor/github.com/coreos/go-systemd \ coreos:pkg:3ac0863d7acf:coreos_pkg/vendor/github.com/coreos/pkg \ dgrijalva:jwt-go:v3.2.0:dgrijalva_jwt_go/vendor/github.com/dgrijalva/jwt-go \ - dswarbrick:smart:909a45200d6d:dswarbrick_smart/vendor/github.com/dswarbrick/smart \ + dominikh:go-tools:v0.0.1-2019.2.3:dominikh_go_tools/vendor/honnef.co/go/tools \ dustin:go-humanize:v1.0.0:dustin_go_humanize/vendor/github.com/dustin/go-humanize \ etcd-io:etcd:8a03d2e9614b:etcd_io_etcd/vendor/go.etcd.io/etcd \ fatih:color:v1.10.0:fatih_color/vendor/github.com/fatih/color \ fatih:structs:v1.1.0:fatih_structs/vendor/github.com/fatih/structs \ go-check:check:038fdea0a05b:go_check_check/vendor/gopkg.in/check.v1 \ go-ini:ini:v1.57.0:go_ini_ini/vendor/gopkg.in/ini.v1 \ go-ole:go-ole:v1.2.4:go_ole_go_ole/vendor/github.com/go-ole/go-ole \ go-yaml:yaml:v2.3.0:go_yaml_yaml/vendor/gopkg.in/yaml.v2 \ gogo:protobuf:v1.3.2:gogo_protobuf/vendor/github.com/gogo/protobuf \ - golang:crypto:5ea612d1eb83:golang_crypto/vendor/golang.org/x/crypto \ - golang:net:986b41b23924:golang_net/vendor/golang.org/x/net \ + golang:crypto:83a5a9bb288b:golang_crypto/vendor/golang.org/x/crypto \ + golang:lint:16217165b5de:golang_lint/vendor/golang.org/x/lint \ + golang:mod:v0.3.0:golang_mod/vendor/golang.org/x/mod \ + golang:net:4e50805a0758:golang_net/vendor/golang.org/x/net \ golang:protobuf:v1.4.3:golang_protobuf/vendor/github.com/golang/protobuf \ - golang:sys:a50acf3fe073:golang_sys/vendor/golang.org/x/sys \ + golang:sys:93ed5bcd2bfe:golang_sys/vendor/golang.org/x/sys \ golang:term:7de9c90e9dd1:golang_term/vendor/golang.org/x/term \ - golang:text:v0.3.3:golang_text/vendor/golang.org/x/text \ + golang:text:v0.3.6:golang_text/vendor/golang.org/x/text \ + golang:tools:v0.1.0:golang_tools/vendor/golang.org/x/tools \ + golang:xerrors:5ec99f83aff1:golang_xerrors/vendor/golang.org/x/xerrors \ google:go-genproto:24fa4b261c55:google_go_genproto/vendor/google.golang.org/genproto \ google:uuid:v1.1.2:google_uuid/vendor/github.com/google/uuid \ grpc:grpc-go:v1.26.0:grpc_grpc_go/vendor/google.golang.org/grpc \ h2non:filetype:v1.0.5:h2non_filetype/vendor/gopkg.in/h2non/filetype.v1 \ hashicorp:errwrap:v1.0.0:hashicorp_errwrap/vendor/github.com/hashicorp/errwrap \ hashicorp:go-multierror:v1.0.0:hashicorp_go_multierror/vendor/github.com/hashicorp/go-multierror \ inconshreveable:go-update:8152e7eb6ccf:inconshreveable_go_update/vendor/github.com/inconshreveable/go-update \ - json-iterator:go:v1.1.10:json_iterator_go/vendor/github.com/json-iterator/go \ - klauspost:compress:v1.11.12:klauspost_compress/vendor/github.com/klauspost/compress \ + json-iterator:go:v1.1.11:json_iterator_go/vendor/github.com/json-iterator/go \ + klauspost:compress:v1.12.2:klauspost_compress/vendor/github.com/klauspost/compress \ klauspost:cpuid:v1.3.1:klauspost_cpuid/vendor/github.com/klauspost/cpuid \ klauspost:cpuid:v2.0.4:klauspost_cpuid_v2/vendor/github.com/klauspost/cpuid/v2 \ kr:text:v0.2.0:kr_text/vendor/github.com/kr/text \ mattn:go-colorable:v0.1.8:mattn_go_colorable/vendor/github.com/mattn/go-colorable \ mattn:go-ieproxy:v0.0.1:mattn_go_ieproxy/vendor/github.com/mattn/go-ieproxy \ mattn:go-isatty:v0.0.12:mattn_go_isatty/vendor/github.com/mattn/go-isatty \ - mattn:go-runewidth:v0.0.9:mattn_go_runewidth/vendor/github.com/mattn/go-runewidth \ + mattn:go-runewidth:v0.0.4:mattn_go_runewidth/vendor/github.com/mattn/go-runewidth \ matttproud:golang_protobuf_extensions:v1.0.1:matttproud_golang_protobuf_extensions/vendor/github.com/matttproud/golang_protobuf_extensions \ + minio:argon2:v1.0.0:minio_argon2/vendor/github.com/minio/argon2 \ minio:cli:v1.22.0:minio_cli/vendor/github.com/minio/cli \ + minio:colorjson:v1.0.0:minio_colorjson/vendor/github.com/minio/colorjson \ + minio:filepath:v1.0.0:minio_filepath/vendor/github.com/minio/filepath \ + minio:madmin-go:v1.0.2:minio_madmin_go/vendor/github.com/minio/madmin-go \ minio:md5-simd:v1.1.1:minio_md5_simd/vendor/github.com/minio/md5-simd \ - minio:minio-go:ba867dba7ee1:minio_minio_go_v7/vendor/github.com/minio/minio-go/v7 \ - minio:minio:38a9f87a560e:minio_minio/vendor/github.com/minio/minio \ + minio:minio-go:f0518ca447d6:minio_minio_go_v7/vendor/github.com/minio/minio-go/v7 \ + minio:minio:3455f786faf0:minio_minio/vendor/github.com/minio/minio \ minio:sha256-simd:v1.0.0:minio_sha256_simd/vendor/github.com/minio/sha256-simd \ mitchellh:go-homedir:v1.1.0:mitchellh_go_homedir/vendor/github.com/mitchellh/go-homedir \ modern-go:concurrent:bacd9c7ef1dd:modern_go_concurrent/vendor/github.com/modern-go/concurrent \ modern-go:reflect2:v1.0.1:modern_go_reflect2/vendor/github.com/modern-go/reflect2 \ montanaflynn:stats:v0.5.0:montanaflynn_stats/vendor/github.com/montanaflynn/stats \ ncw:directio:v1.0.5:ncw_directio/vendor/github.com/ncw/directio \ niemeyer:pretty:a10e7caefd8e:niemeyer_pretty/vendor/github.com/niemeyer/pretty \ + philhofer:fwd:v1.1.1:philhofer_fwd/vendor/github.com/philhofer/fwd \ pkg:profile:v1.3.0:pkg_profile/vendor/github.com/pkg/profile \ pkg:xattr:v0.4.1:pkg_xattr/vendor/github.com/pkg/xattr \ posener:complete:v1.2.3:posener_complete/vendor/github.com/posener/complete \ prometheus:client_golang:v1.8.0:prometheus_client_golang/vendor/github.com/prometheus/client_golang \ prometheus:client_model:v0.2.0:prometheus_client_model/vendor/github.com/prometheus/client_model \ prometheus:common:v0.14.0:prometheus_common/vendor/github.com/prometheus/common \ prometheus:procfs:v0.6.0:prometheus_procfs/vendor/github.com/prometheus/procfs \ protocolbuffers:protobuf-go:v1.23.0:protocolbuffers_protobuf_go/vendor/google.golang.org/protobuf \ rjeczalik:notify:v0.9.2:rjeczalik_notify/vendor/github.com/rjeczalik/notify \ rs:xid:v1.2.1:rs_xid/vendor/github.com/rs/xid \ secure-io:sio-go:v0.3.1:secure_io_sio_go/vendor/github.com/secure-io/sio-go \ - shirou:gopsutil:v3.21.1:shirou_gopsutil_v3/vendor/github.com/shirou/gopsutil \ - tidwall:gjson:v1.6.8:tidwall_gjson/vendor/github.com/tidwall/gjson \ + shirou:gopsutil:v3.21.3:shirou_gopsutil_v3/vendor/github.com/shirou/gopsutil \ + tidwall:gjson:v1.7.5:tidwall_gjson/vendor/github.com/tidwall/gjson \ tidwall:match:v1.0.3:tidwall_match/vendor/github.com/tidwall/match \ - tidwall:pretty:v1.0.2:tidwall_pretty/vendor/github.com/tidwall/pretty \ - uber-go:atomic:v1.6.0:uber_go_atomic/vendor/go.uber.org/atomic \ - uber-go:multierr:v1.5.0:uber_go_multierr/vendor/go.uber.org/multierr \ - uber-go:zap:v1.14.1:uber_go_zap/vendor/go.uber.org/zap + tidwall:pretty:v1.1.0:tidwall_pretty/vendor/github.com/tidwall/pretty \ + tinylib:msgp:v1.1.3:tinylib_msgp/vendor/github.com/tinylib/msgp \ + tklauser:go-sysconf:v0.3.4:tklauser_go_sysconf/vendor/github.com/tklauser/go-sysconf \ + tklauser:numcpus:v0.2.1:tklauser_numcpus/vendor/github.com/tklauser/numcpus \ + uber-go:atomic:v1.5.0:uber_go_atomic/vendor/go.uber.org/atomic \ + uber-go:multierr:v1.3.0:uber_go_multierr/vendor/go.uber.org/multierr \ + uber-go:tools:2cfd321de3ee:uber_go_tools/vendor/go.uber.org/tools \ + uber-go:zap:v1.13.0:uber_go_zap/vendor/go.uber.org/zap PLIST_FILES= bin/${MC} GO_BUILDFLAGS= -ldflags=" \ -X github.com/minio/mc/cmd.Version=${GH_TAGNAME:C/RELEASE\.//:C|(..)-(..)-(..)Z|\1:\2:\3Z|} \ -X github.com/minio/mc/cmd.ReleaseTag=${GH_TAGNAME} \ -X github.com/minio/mc/cmd.CommitID=${COMMIT_ID} \ -X github.com/minio/mc/cmd.GOPATH=${WRKSRC} -s -w" GO_TARGET= :${MC} post-extract: ${RM} ${WRKSRC}/cmd/client-fs_freebsd_netbsd.go ${RM} ${WRKSRC}/pkg/disk/stat_freebsd_netbsd.go + ${MKDIR} ${WRKSRC}/vendor/maze.io/x/duration + ${CP} ${FILESDIR}/duration.go ${WRKSRC}/vendor/maze.io/x/duration/duration.go .include diff --git a/www/minio-client/distinfo b/www/minio-client/distinfo index e8e1cdabd9c4..f2aa38ba14b4 100644 --- a/www/minio-client/distinfo +++ b/www/minio-client/distinfo @@ -1,143 +1,171 @@ -TIMESTAMP = 1619219949 -SHA256 (minio-mc-2021.04.22.17.40.00-RELEASE.2021-04-22T17-40-00Z_GH0.tar.gz) = b468b57c7e852d7fd4db4746933f8fb1fa5d9b34c4ce46be8e40a2d626d8b6f0 -SIZE (minio-mc-2021.04.22.17.40.00-RELEASE.2021-04-22T17-40-00Z_GH0.tar.gz) = 445931 +TIMESTAMP = 1622831941 +SHA256 (minio-mc-2021.05.26.19.19.26-RELEASE.2021-05-26T19-19-26Z_GH0.tar.gz) = 6795fe32440f36e9cc4357c32990a8b84ea6ddc89cdbef279f562eb90eab143c +SIZE (minio-mc-2021.05.26.19.19.26-RELEASE.2021-05-26T19-19-26Z_GH0.tar.gz) = 395682 +SHA256 (BurntSushi-toml-v0.3.1_GH0.tar.gz) = 6593da894578ba510a470735ffbdc88ce88033094dc5a8f4d3957ab87e18803f +SIZE (BurntSushi-toml-v0.3.1_GH0.tar.gz) = 42077 SHA256 (StackExchange-wmi-cbe66965904d_GH0.tar.gz) = 14dbc4af6952acdb1b941d002cd36fd2299aa6b3144cbcbddbb032c47f816da5 SIZE (StackExchange-wmi-cbe66965904d_GH0.tar.gz) = 11279 SHA256 (beorn7-perks-v1.0.1_GH0.tar.gz) = 98db84bb0224a26094e6adba91b7ee7a1a7ace28cb648d818f8e779e6a19f825 SIZE (beorn7-perks-v1.0.1_GH0.tar.gz) = 10867 SHA256 (cespare-xxhash-v2.1.1_GH0.tar.gz) = 0ee31178d2c5a1249be4e26294a2f428008dc4e1ecbbfbe47f74e41026df1148 SIZE (cespare-xxhash-v2.1.1_GH0.tar.gz) = 9292 SHA256 (cheggaaa-pb-v1.0.29_GH0.tar.gz) = 73090c024e062216207ccd7a3339da3d1f87396abccd3271ed26e42c7d487eb2 SIZE (cheggaaa-pb-v1.0.29_GH0.tar.gz) = 30824 SHA256 (coreos-go-semver-v0.2.0_GH0.tar.gz) = 0f15084aee23324e12e5e4542c9f7b0c809d7207b0e90829d1554b234cd8dd4a SIZE (coreos-go-semver-v0.2.0_GH0.tar.gz) = 8474 SHA256 (coreos-go-systemd-39ca1b05acc7_GH0.tar.gz) = 56bb345a9ab6838b652e70dbb2d50930e0f0f8f5fa32de0d1b67fef8841a6fe6 SIZE (coreos-go-systemd-39ca1b05acc7_GH0.tar.gz) = 60403 SHA256 (coreos-pkg-3ac0863d7acf_GH0.tar.gz) = 47b8ca2aa02823801b4744653a74a489fbdd8d9c5c67e205781f07b8b6b6c8f4 SIZE (coreos-pkg-3ac0863d7acf_GH0.tar.gz) = 31017 SHA256 (dgrijalva-jwt-go-v3.2.0_GH0.tar.gz) = 197465ef53219f3aeb1a6940b70e16d288fe4e4108d4831b91ea101118440e63 SIZE (dgrijalva-jwt-go-v3.2.0_GH0.tar.gz) = 36960 -SHA256 (dswarbrick-smart-909a45200d6d_GH0.tar.gz) = 1b30ea27fd65aacebd1148b1de9a147324b74d87958a3bb22eff669e1d08d335 -SIZE (dswarbrick-smart-909a45200d6d_GH0.tar.gz) = 26457 +SHA256 (dominikh-go-tools-v0.0.1-2019.2.3_GH0.tar.gz) = 3b16c5bec68f71d13be0216b849ce910aa4a1844db6e08dafe90fb1a439974c7 +SIZE (dominikh-go-tools-v0.0.1-2019.2.3_GH0.tar.gz) = 367559 SHA256 (dustin-go-humanize-v1.0.0_GH0.tar.gz) = e4540bd50ac855143b4f2e509313079c50cf5d8774f09cc10dbca5ae9803d8ba SIZE (dustin-go-humanize-v1.0.0_GH0.tar.gz) = 17260 SHA256 (etcd-io-etcd-8a03d2e9614b_GH0.tar.gz) = 0f8a3a8edd80d58ddced5c786b3e554e0432ade280b6c74c9890e6e080d6b654 SIZE (etcd-io-etcd-8a03d2e9614b_GH0.tar.gz) = 9181974 SHA256 (fatih-color-v1.10.0_GH0.tar.gz) = a00342a7ffb8b119346dce56e152a111cbb9eab3970c429cc2ed4272aec2858e SIZE (fatih-color-v1.10.0_GH0.tar.gz) = 1267532 SHA256 (fatih-structs-v1.1.0_GH0.tar.gz) = 7479adacd8172f74968da4e1e14f1cc47c0bc98c48f44c09c497416dc8c9dfe4 SIZE (fatih-structs-v1.1.0_GH0.tar.gz) = 14444 SHA256 (go-check-check-038fdea0a05b_GH0.tar.gz) = 34397249e49a9b3fa268b3517acde4505e3c98ac6aaa765f9d6b4d4a67e26e04 SIZE (go-check-check-038fdea0a05b_GH0.tar.gz) = 31645 SHA256 (go-ini-ini-v1.57.0_GH0.tar.gz) = e612924cffa395825f32e65db18cff0366705952433e52c6efc81fc1c3adfd2a SIZE (go-ini-ini-v1.57.0_GH0.tar.gz) = 48424 SHA256 (go-ole-go-ole-v1.2.4_GH0.tar.gz) = 1f30df494ffc50c133c5f276f64c94820046b1a3a660c0cca49a5c3a8106db11 SIZE (go-ole-go-ole-v1.2.4_GH0.tar.gz) = 51655 SHA256 (go-yaml-yaml-v2.3.0_GH0.tar.gz) = 42027002bf258009d498600b04b8c9cbb29d2193185ea7bfa8fefe194fe72a07 SIZE (go-yaml-yaml-v2.3.0_GH0.tar.gz) = 72816 SHA256 (gogo-protobuf-v1.3.2_GH0.tar.gz) = 2bb4b13d6e56b3911f09b8e9ddd15708477fbff8823c057cc79dd99c9a452b34 SIZE (gogo-protobuf-v1.3.2_GH0.tar.gz) = 2038725 -SHA256 (golang-crypto-5ea612d1eb83_GH0.tar.gz) = ab4d88d6121195632d006705a950adebaf4fa99dd15ea0c508297a17c5d3277e -SIZE (golang-crypto-5ea612d1eb83_GH0.tar.gz) = 1726242 -SHA256 (golang-net-986b41b23924_GH0.tar.gz) = a39c45e02c28265764b87106e986e8ce4c2236babf75b2f7b4cafe48e9afaa4b -SIZE (golang-net-986b41b23924_GH0.tar.gz) = 1251244 +SHA256 (golang-crypto-83a5a9bb288b_GH0.tar.gz) = c6aa1fc9104536c3335135c9c0bf5a9c2ee3cedc05a937a24cee93aa21a72d80 +SIZE (golang-crypto-83a5a9bb288b_GH0.tar.gz) = 1726653 +SHA256 (golang-lint-16217165b5de_GH0.tar.gz) = e1b870caa2e428d183d6a467be064578582bacc19615e50867c24d53080ba496 +SIZE (golang-lint-16217165b5de_GH0.tar.gz) = 31428 +SHA256 (golang-mod-v0.3.0_GH0.tar.gz) = bc97bb300928a00cfe64d97b3240c760668060cda0767e0d0b413e506fc3fa0a +SIZE (golang-mod-v0.3.0_GH0.tar.gz) = 93941 +SHA256 (golang-net-4e50805a0758_GH0.tar.gz) = 33bf098bf9b0b0bffa1708a9b661b2446373156040c496fe2e9c088aeaa9937f +SIZE (golang-net-4e50805a0758_GH0.tar.gz) = 1247392 SHA256 (golang-protobuf-v1.4.3_GH0.tar.gz) = 5736f943f8647362f5559689df6154f3c85d261fb088867c8a68494e2a767610 SIZE (golang-protobuf-v1.4.3_GH0.tar.gz) = 171969 -SHA256 (golang-sys-a50acf3fe073_GH0.tar.gz) = 1264b2f94ab2a3d38c7db91eafcd18f7222139ec2458d9f3bca4b5459bf69b71 -SIZE (golang-sys-a50acf3fe073_GH0.tar.gz) = 1175555 +SHA256 (golang-sys-93ed5bcd2bfe_GH0.tar.gz) = 71cb395a4a64fc6ff1687f6bc9ed9f34f4732c499f6ee5aaddf87b82a24ecefc +SIZE (golang-sys-93ed5bcd2bfe_GH0.tar.gz) = 1219370 SHA256 (golang-term-7de9c90e9dd1_GH0.tar.gz) = 73603eaab2ab2bfe05061d64ad09f8ed7469de6964a672398f7bf82cffb4b1da SIZE (golang-term-7de9c90e9dd1_GH0.tar.gz) = 15239 -SHA256 (golang-text-v0.3.3_GH0.tar.gz) = 1604233637e3593749fbbb13b5069b08e6feba6d2b55a02fd3148793d5871185 -SIZE (golang-text-v0.3.3_GH0.tar.gz) = 7747332 +SHA256 (golang-text-v0.3.6_GH0.tar.gz) = f66bebcf21985b0a713d67c6c35dfc9800d3b6d00d62b83ed0ce5b2ed4cb9760 +SIZE (golang-text-v0.3.6_GH0.tar.gz) = 8351095 +SHA256 (golang-tools-v0.1.0_GH0.tar.gz) = 88f66c1a7ff0f7fce20c0808d2769baa977f56f74197c9681cd864d0977e97a2 +SIZE (golang-tools-v0.1.0_GH0.tar.gz) = 2683055 +SHA256 (golang-xerrors-5ec99f83aff1_GH0.tar.gz) = 71975d658357e170fd6a41f92539cde8b39c9cd8bfe5931b6311bc5f5c0da0d7 +SIZE (golang-xerrors-5ec99f83aff1_GH0.tar.gz) = 13664 SHA256 (google-go-genproto-24fa4b261c55_GH0.tar.gz) = 96481b64c5971de2dd22d7c6f764d2acbeb4cd85ab6166856284115c3f99238c SIZE (google-go-genproto-24fa4b261c55_GH0.tar.gz) = 5332241 SHA256 (google-uuid-v1.1.2_GH0.tar.gz) = e650558e314307cf33391d0a9ef575b418188206d61cb9751e9f11bceb0874d0 SIZE (google-uuid-v1.1.2_GH0.tar.gz) = 13871 SHA256 (grpc-grpc-go-v1.26.0_GH0.tar.gz) = a594cbd8f7d545d181c92b27aafd5d4824459e3a729a8bd67a0c8b99c411f05a SIZE (grpc-grpc-go-v1.26.0_GH0.tar.gz) = 765416 SHA256 (h2non-filetype-v1.0.5_GH0.tar.gz) = b85917fdb72b8d32626c6bb7fbdf6ef5826c68905de381a20f9acb215cb1dce8 SIZE (h2non-filetype-v1.0.5_GH0.tar.gz) = 685707 SHA256 (hashicorp-errwrap-v1.0.0_GH0.tar.gz) = 26afc0e5895c6ce87c881c5c02c682ccc9a08174a9c27ca26d4a1e72dbf78128 SIZE (hashicorp-errwrap-v1.0.0_GH0.tar.gz) = 8346 SHA256 (hashicorp-go-multierror-v1.0.0_GH0.tar.gz) = 5ae83eea62b2c845d41087c38c878741337e092db114b9a7ca9aebe5bf1dd264 SIZE (hashicorp-go-multierror-v1.0.0_GH0.tar.gz) = 10066 SHA256 (inconshreveable-go-update-8152e7eb6ccf_GH0.tar.gz) = 507bf16c9e400a4e86954357534d932a18a3c9bbfdd1d6b8f58ddf33b84f7001 SIZE (inconshreveable-go-update-8152e7eb6ccf_GH0.tar.gz) = 27137 -SHA256 (json-iterator-go-v1.1.10_GH0.tar.gz) = 15e761079f413a9edcf86ea628998e328c12aaed92af462363191fa76e9809a6 -SIZE (json-iterator-go-v1.1.10_GH0.tar.gz) = 83384 -SHA256 (klauspost-compress-v1.11.12_GH0.tar.gz) = ff477d18e3bb9731f8600a41f56cb34d68d4ea47f5cc55974be978303d129296 -SIZE (klauspost-compress-v1.11.12_GH0.tar.gz) = 17453513 +SHA256 (json-iterator-go-v1.1.11_GH0.tar.gz) = 19d0d56ac18a052867360b10201bad614c7b31a3edf2041a331c28860920b932 +SIZE (json-iterator-go-v1.1.11_GH0.tar.gz) = 84401 +SHA256 (klauspost-compress-v1.12.2_GH0.tar.gz) = 81903dc55aef9ada8df786e8edbaa4f4253a29da3068799360d74c2e1b863ebe +SIZE (klauspost-compress-v1.12.2_GH0.tar.gz) = 15347123 SHA256 (klauspost-cpuid-v1.3.1_GH0.tar.gz) = 3bf2da7358c8ed33c05bac2ca733749ade03eadf184d81cc7b16fcbe2e230f1d SIZE (klauspost-cpuid-v1.3.1_GH0.tar.gz) = 367144 SHA256 (klauspost-cpuid-v2.0.4_GH0.tar.gz) = 12cc5d89b732bcd884148909a10c506b1b93932ab6fc6f46f4b5de469ecec77b SIZE (klauspost-cpuid-v2.0.4_GH0.tar.gz) = 339132 SHA256 (kr-text-v0.2.0_GH0.tar.gz) = 59b5e4a7fd4097be87fad0edcaf342fdc971d0c8fdfb4f2d7424561471992e7c SIZE (kr-text-v0.2.0_GH0.tar.gz) = 8699 SHA256 (mattn-go-colorable-v0.1.8_GH0.tar.gz) = 1027954f9abbe06b6e117e3047af70204dd0eb4f8c27fcd459fb2574b279755f SIZE (mattn-go-colorable-v0.1.8_GH0.tar.gz) = 9571 SHA256 (mattn-go-ieproxy-v0.0.1_GH0.tar.gz) = 26cc1f0d9ba19556cd91e0d4ed07ba2042eacd07c5b9aec082f7a77e2ef1fa28 SIZE (mattn-go-ieproxy-v0.0.1_GH0.tar.gz) = 9090 SHA256 (mattn-go-isatty-v0.0.12_GH0.tar.gz) = addbdc341d7685ed4cc8d2d8a8fd2bd9b784bde00d0ea99fb251039fc10c611c SIZE (mattn-go-isatty-v0.0.12_GH0.tar.gz) = 4548 -SHA256 (mattn-go-runewidth-v0.0.9_GH0.tar.gz) = 4f20a337ad06e071f29535afe9c5207d3e8840c8c86672bbc5f9837c6229c835 -SIZE (mattn-go-runewidth-v0.0.9_GH0.tar.gz) = 16714 +SHA256 (mattn-go-runewidth-v0.0.4_GH0.tar.gz) = 1973c2de25bc69c3786a00e8118f4d22aa0d040bdfe46c8c8c30419b23e53dfe +SIZE (mattn-go-runewidth-v0.0.4_GH0.tar.gz) = 19827 SHA256 (matttproud-golang_protobuf_extensions-v1.0.1_GH0.tar.gz) = 2def0ee6f6b12b1efc0e3007d89f598608a072610e805c3655ea9d13c3ead49b SIZE (matttproud-golang_protobuf_extensions-v1.0.1_GH0.tar.gz) = 37184 +SHA256 (minio-argon2-v1.0.0_GH0.tar.gz) = c0529b5a0db65e98ec9a02db68aac00d0aedfe0d4860a1b2c0c57ff967e09640 +SIZE (minio-argon2-v1.0.0_GH0.tar.gz) = 8476 SHA256 (minio-cli-v1.22.0_GH0.tar.gz) = f91306a2f1f434e9c31d737914288661286b329a3008f42b7212c6c9f15c3fca SIZE (minio-cli-v1.22.0_GH0.tar.gz) = 58896 +SHA256 (minio-colorjson-v1.0.0_GH0.tar.gz) = 857a2e39681b081bab861245a5f164e2c44bf166524087db832bb010bc0169c5 +SIZE (minio-colorjson-v1.0.0_GH0.tar.gz) = 30407 +SHA256 (minio-filepath-v1.0.0_GH0.tar.gz) = aaf9252ffde11accab6dedabe7628dfa605df166e9839c11b9b05cb2740e6d7a +SIZE (minio-filepath-v1.0.0_GH0.tar.gz) = 1697 +SHA256 (minio-madmin-go-v1.0.2_GH0.tar.gz) = 731a80ef13fdc2ea84dfba253e97dbfd800c3139668fea220fcdf100be496dc4 +SIZE (minio-madmin-go-v1.0.2_GH0.tar.gz) = 137095 SHA256 (minio-md5-simd-v1.1.1_GH0.tar.gz) = 8c7cff580a084493e2fe863aad69497f9a7aebd824ddb97b8e34df2e1f3a83a1 SIZE (minio-md5-simd-v1.1.1_GH0.tar.gz) = 99915 -SHA256 (minio-minio-go-ba867dba7ee1_GH0.tar.gz) = 0c30c1e29def2771a3ec7066335bf1021dd42e84d7f4482f1f16fa930563f6f3 -SIZE (minio-minio-go-ba867dba7ee1_GH0.tar.gz) = 237686 -SHA256 (minio-minio-38a9f87a560e_GH0.tar.gz) = 169ae4c2b317da4a67ef936a9f14378ca35135e12a922134af86d64c68810d22 -SIZE (minio-minio-38a9f87a560e_GH0.tar.gz) = 10626266 +SHA256 (minio-minio-go-f0518ca447d6_GH0.tar.gz) = 65311115bf3d0b0cc8dc078826cb6df5a2589598e41df88af8c60236549d7ff2 +SIZE (minio-minio-go-f0518ca447d6_GH0.tar.gz) = 236814 +SHA256 (minio-minio-3455f786faf0_GH0.tar.gz) = 22a303110c65cde7d82ce23ace4b60096da53a147ced8ca65ec8831cad31b0d3 +SIZE (minio-minio-3455f786faf0_GH0.tar.gz) = 10617127 SHA256 (minio-sha256-simd-v1.0.0_GH0.tar.gz) = f992f67a47d16983f9bab99203aaab044618f13ca1de507c33a70a53de8331e0 SIZE (minio-sha256-simd-v1.0.0_GH0.tar.gz) = 49020 SHA256 (mitchellh-go-homedir-v1.1.0_GH0.tar.gz) = 646671c73a84a8dfb4a5a76b80c7b63549ffefa906524d45077301bc7da76600 SIZE (mitchellh-go-homedir-v1.1.0_GH0.tar.gz) = 3362 SHA256 (modern-go-concurrent-bacd9c7ef1dd_GH0.tar.gz) = d673e902118a6ece63198dc7e0961e904d0410f142726df0936ec1a52035a60f SIZE (modern-go-concurrent-bacd9c7ef1dd_GH0.tar.gz) = 7526 SHA256 (modern-go-reflect2-v1.0.1_GH0.tar.gz) = d24e856d9aa8fd51b9e6c2cdd712a44c8d18cb8b72802f1bd16e0470322363fd SIZE (modern-go-reflect2-v1.0.1_GH0.tar.gz) = 14394 SHA256 (montanaflynn-stats-v0.5.0_GH0.tar.gz) = 7013ef675c1836a574e20ae81b71ac4854796cc2a8abf55e176d4643849e3778 SIZE (montanaflynn-stats-v0.5.0_GH0.tar.gz) = 28893 SHA256 (ncw-directio-v1.0.5_GH0.tar.gz) = d21504ec4d2d13b708454388ac877f5ac7e8a60333da07e98b38626bcf4dadcd SIZE (ncw-directio-v1.0.5_GH0.tar.gz) = 3914 SHA256 (niemeyer-pretty-a10e7caefd8e_GH0.tar.gz) = 2a81e75bdd5341bd0fac76a90bb024ed2ac6c8a5d31d70cd715eef75224601e1 SIZE (niemeyer-pretty-a10e7caefd8e_GH0.tar.gz) = 9399 +SHA256 (philhofer-fwd-v1.1.1_GH0.tar.gz) = f8a9e7bc2fffb117eec31666b8aa61bfb3d46e858b0b50fa90d98a6f1f0ebf18 +SIZE (philhofer-fwd-v1.1.1_GH0.tar.gz) = 9790 SHA256 (pkg-profile-v1.3.0_GH0.tar.gz) = 6af6c06236d24dbabe7d943e08b1bbf24da3ce74985dbb1579ce494548973006 SIZE (pkg-profile-v1.3.0_GH0.tar.gz) = 5822 SHA256 (pkg-xattr-v0.4.1_GH0.tar.gz) = 40fba2af8dd901000a7c9a1eb1d760695783ee6598f89c3e5a71ecb8ffe1e43a SIZE (pkg-xattr-v0.4.1_GH0.tar.gz) = 8306 SHA256 (posener-complete-v1.2.3_GH0.tar.gz) = 2ea9ccea70aae01118c8ffeb608aa57a894c2917cbdd3332a89edeba47241018 SIZE (posener-complete-v1.2.3_GH0.tar.gz) = 22736 SHA256 (prometheus-client_golang-v1.8.0_GH0.tar.gz) = 90ffc935a71704c5c53c6a6f878a5195754a441267a338783fb747fb987714c3 SIZE (prometheus-client_golang-v1.8.0_GH0.tar.gz) = 175641 SHA256 (prometheus-client_model-v0.2.0_GH0.tar.gz) = 4ab1be9cdfa702d7f49beeb09a256bcc6a2aad55e8a0a37e7732a46934264e12 SIZE (prometheus-client_model-v0.2.0_GH0.tar.gz) = 10986 SHA256 (prometheus-common-v0.14.0_GH0.tar.gz) = 1b93e29dd621ed22bb7a7351487e22013f43c96d05c6c63ffc11236abe166f36 SIZE (prometheus-common-v0.14.0_GH0.tar.gz) = 124248 SHA256 (prometheus-procfs-v0.6.0_GH0.tar.gz) = 6ad7a23cf4db9fa5dbf2c5d8fbd0fbf5ffe48e3ddb7bf15f9359813d764ce73c SIZE (prometheus-procfs-v0.6.0_GH0.tar.gz) = 169898 SHA256 (protocolbuffers-protobuf-go-v1.23.0_GH0.tar.gz) = e7266bedaa4f110216fce52ae533dc5eba475d3829bb0592e8876684e202ae1f SIZE (protocolbuffers-protobuf-go-v1.23.0_GH0.tar.gz) = 1214648 SHA256 (rjeczalik-notify-v0.9.2_GH0.tar.gz) = 840f2c523ed6023eca8c04456f5d9748c44c685fdd2f9fa2ee458baafcd91c38 SIZE (rjeczalik-notify-v0.9.2_GH0.tar.gz) = 56851 SHA256 (rs-xid-v1.2.1_GH0.tar.gz) = bb207227d5ae99bda71d38ae11e29b822c9b572223781bc282ad2f8e69002f2c SIZE (rs-xid-v1.2.1_GH0.tar.gz) = 9553 SHA256 (secure-io-sio-go-v0.3.1_GH0.tar.gz) = 12728c554fcfab43b59539e508597883d7d865f152f205f7dfe8d5b5534b5e63 SIZE (secure-io-sio-go-v0.3.1_GH0.tar.gz) = 21375 -SHA256 (shirou-gopsutil-v3.21.1_GH0.tar.gz) = 7a21f968bce681a748960bcf94f876edfe68b9be6391d0dbaa137ac244ad785d -SIZE (shirou-gopsutil-v3.21.1_GH0.tar.gz) = 285706 -SHA256 (tidwall-gjson-v1.6.8_GH0.tar.gz) = f87995c92093597e0e49e4e611b207786653d806a2ecd088501c81a47f68b29e -SIZE (tidwall-gjson-v1.6.8_GH0.tar.gz) = 52091 +SHA256 (shirou-gopsutil-v3.21.3_GH0.tar.gz) = bf03056f5012be0d799bfc5851a4819045247ec24ae4c0fdb80c029847ece38d +SIZE (shirou-gopsutil-v3.21.3_GH0.tar.gz) = 282358 +SHA256 (tidwall-gjson-v1.7.5_GH0.tar.gz) = 97d7cc8e7ea056db0f11c846869c7ed67e682c90839be808e0c4c1447aec9cf0 +SIZE (tidwall-gjson-v1.7.5_GH0.tar.gz) = 50355 SHA256 (tidwall-match-v1.0.3_GH0.tar.gz) = 12f9c257baf7c96eb009b3f814326ef95837bf84a4f9fcc2816cf12e78aa0f9e SIZE (tidwall-match-v1.0.3_GH0.tar.gz) = 4829 -SHA256 (tidwall-pretty-v1.0.2_GH0.tar.gz) = 820d92d4bb31a9f5a03f4168a5c4ff4ca50d8fd4a72bdf24257b5e4a0acf0ee5 -SIZE (tidwall-pretty-v1.0.2_GH0.tar.gz) = 8865 -SHA256 (uber-go-atomic-v1.6.0_GH0.tar.gz) = 34abb632809f28d4106660d0211dfa624968c4d021717a2e16e1c6bf2606f34a -SIZE (uber-go-atomic-v1.6.0_GH0.tar.gz) = 9678 -SHA256 (uber-go-multierr-v1.5.0_GH0.tar.gz) = 15fdd69d5f35e1c5c472d02b58fe3e229795d930398f9017c6c43a108504eaf1 -SIZE (uber-go-multierr-v1.5.0_GH0.tar.gz) = 12336 -SHA256 (uber-go-zap-v1.14.1_GH0.tar.gz) = 6d6a64adc83b084c777f8e6c876eb2953376a92e7099571119185a004d53b1f0 -SIZE (uber-go-zap-v1.14.1_GH0.tar.gz) = 125870 +SHA256 (tidwall-pretty-v1.1.0_GH0.tar.gz) = 3b29b957afa66beb8eee7cd5910b3f4e3cd1dbe72f93e563c8e8e297d14a87d5 +SIZE (tidwall-pretty-v1.1.0_GH0.tar.gz) = 10503 +SHA256 (tinylib-msgp-v1.1.3_GH0.tar.gz) = f4b6312d8f6cae7363941d69be2b4aa9ed49373dda6c7b25229fb4b7004f4c22 +SIZE (tinylib-msgp-v1.1.3_GH0.tar.gz) = 83481 +SHA256 (tklauser-go-sysconf-v0.3.4_GH0.tar.gz) = f873a047b9000e7bbfe0eede66565a04dbf5ecf0c251f5a7e406b3f23916cf6b +SIZE (tklauser-go-sysconf-v0.3.4_GH0.tar.gz) = 26998 +SHA256 (tklauser-numcpus-v0.2.1_GH0.tar.gz) = 3768c36e2e08c9b6c5edd499b19418e20845f2a3ab7131e9ef0df0049afdf68a +SIZE (tklauser-numcpus-v0.2.1_GH0.tar.gz) = 8118 +SHA256 (uber-go-atomic-v1.5.0_GH0.tar.gz) = 3b003515efb86c67aced0ce9e954cca50964ee0afe83e5a63dfe43aa58347290 +SIZE (uber-go-atomic-v1.5.0_GH0.tar.gz) = 9365 +SHA256 (uber-go-multierr-v1.3.0_GH0.tar.gz) = 54bba1d61d996b98ccdf1d353e0fc66bbff599fe202719d1f55e490e127be574 +SIZE (uber-go-multierr-v1.3.0_GH0.tar.gz) = 11537 +SHA256 (uber-go-tools-2cfd321de3ee_GH0.tar.gz) = a7d91d3ddea6d8a83240af46436e02d65b835b60bcb85ad1c5bc6aebad32f567 +SIZE (uber-go-tools-2cfd321de3ee_GH0.tar.gz) = 11054 +SHA256 (uber-go-zap-v1.13.0_GH0.tar.gz) = dcadd2fc1a93124b594e2fd951456bb1727f922f5ef005e388273851d0607ae7 +SIZE (uber-go-zap-v1.13.0_GH0.tar.gz) = 122949 diff --git a/www/minio-client/files/duration.go b/www/minio-client/files/duration.go new file mode 100644 index 000000000000..5d4c21344a3e --- /dev/null +++ b/www/minio-client/files/duration.go @@ -0,0 +1,388 @@ +// Package duration contains routines to parse standard units of time. +package duration + +import ( + "errors" + "time" +) + +// Duration is a standard unit of time. +type Duration time.Duration + +// String returns a string representing the duration in the form "3d1h3m". +// Leading zero units are omitted. As a special case, durations less than one +// second format use a smaller unit (milli-, micro-, or nanoseconds) to ensure +// that the leading digit is non-zero. Duration more than a day or more than a +// week lose granularity and are truncated to resp. days-hours-minutes and +// weeks-days-hours. The zero duration formats as 0s. +func (d Duration) String() string { + // Largest time is 2540400h10m10.000000000s + var buf [32]byte + w := len(buf) + + u := uint64(d) + neg := d < 0 + if neg { + u = -u + } + + if u < uint64(Second) { + // Special case: if duration is smaller than a second, + // use smaller units, like 1.2ms + var prec int + w-- + buf[w] = 's' + w-- + switch { + case u == 0: + return "0s" + case u < uint64(Microsecond): + // print nanoseconds + prec = 0 + buf[w] = 'n' + case u < uint64(Millisecond): + // print microseconds + prec = 3 + // U+00B5 'µ' micro sign == 0xC2 0xB5 + w-- // Need room for two bytes. + copy(buf[w:], "µ") + default: + // print milliseconds + prec = 6 + buf[w] = 'm' + } + w, u = fmtFrac(buf[:w], u, prec) + w = fmtInt(buf[:w], u) + + } else if u > uint64(Week) { + // Special case: if duration is larger than a week, + // use bigger units like 4w3d2h + w-- + buf[w] = 'h' + + u /= uint64(Hour) + + // u is now integer hours + w = fmtInt(buf[:w], u%24) + u /= 24 + + // u is now integer days + if u > 0 { + w-- + buf[w] = 'd' + w = fmtInt(buf[:w], u%7) + u /= 7 + + // u is now integer weeks + // Stop at hours because days can be different lengths. + if u > 0 { + w-- + buf[w] = 'w' + w = fmtInt(buf[:w], u) + } + } + + } else if u > uint64(Day) { + // Special case: if duration is larger than a day, + // use bigger units like 3d2h6m + w-- + buf[w] = 'm' + + u /= uint64(Minute) + + // u is now integer minutes + w = fmtInt(buf[:w], u%60) + u /= 60 + + // u is now integer hours + if u > 0 { + w-- + buf[w] = 'h' + w = fmtInt(buf[:w], u%24) + u /= 24 + + // u is now integer weeks + if u > 0 { + w-- + buf[w] = 'd' + w = fmtInt(buf[:w], u) + } + } + + } else { + w-- + buf[w] = 's' + + w, u = fmtFrac(buf[:w], u, 9) + + // u is now integer seconds + w = fmtInt(buf[:w], u%60) + u /= 60 + + // u is now integer minutes + if u > 0 { + w-- + buf[w] = 'm' + w = fmtInt(buf[:w], u%60) + u /= 60 + + // u is now integer hours + // Stop at hours because days can be different lengths. + if u > 0 { + w-- + buf[w] = 'h' + w = fmtInt(buf[:w], u) + } + } + } + + if neg { + w-- + buf[w] = '-' + } + + return string(buf[w:]) +} + +// fmtFrac formats the fraction of v/10**prec (e.g., ".12345") into the +// tail of buf, omitting trailing zeros. it omits the decimal +// point too when the fraction is 0. It returns the index where the +// output bytes begin and the value v/10**prec. +func fmtFrac(buf []byte, v uint64, prec int) (nw int, nv uint64) { + // Omit trailing zeros up to and including decimal point. + w := len(buf) + print := false + for i := 0; i < prec; i++ { + digit := v % 10 + print = print || digit != 0 + if print { + w-- + buf[w] = byte(digit) + '0' + } + v /= 10 + } + if print { + w-- + buf[w] = '.' + } + return w, v +} + +// fmtInt formats v into the tail of buf. +// It returns the index where the output begins. +func fmtInt(buf []byte, v uint64) int { + w := len(buf) + if v == 0 { + w-- + buf[w] = '0' + } else { + for v > 0 { + w-- + buf[w] = byte(v%10) + '0' + v /= 10 + } + } + return w +} + +// Nanoseconds returns the duration as an integer nanosecond count. +func (d Duration) Nanoseconds() int64 { return int64(d) } + +// Seconds returns the duration as a floating point number of seconds. +func (d Duration) Seconds() float64 { + sec := d / Second + nsec := d % Second + return float64(sec) + float64(nsec)*1e-9 +} + +// Hours returns the duration as a floating point number of hours. +func (d Duration) Hours() float64 { + hour := d / Hour + nsec := d % Hour + return float64(hour) + float64(nsec)*(1e-9/60/60) +} + +// Days returns the duration as a floating point number of days. +func (d Duration) Days() float64 { + hour := d / Hour + nsec := d % Hour + return float64(hour) + float64(nsec)*(1e-9/60/60/24) +} + +// Weeks returns the duration as a floating point number of days. +func (d Duration) Weeks() float64 { + hour := d / Hour + nsec := d % Hour + return float64(hour) + float64(nsec)*(1e-9/60/60/24/7) +} + +// Minutes returns the duration as a floating point number of minutes. +func (d Duration) Minutes() float64 { + min := d / Minute + nsec := d % Minute + return float64(min) + float64(nsec)*(1e-9/60) +} + +// Standard unit of time. +var ( + Nanosecond = Duration(time.Nanosecond) + Microsecond = Duration(time.Microsecond) + Millisecond = Duration(time.Millisecond) + Second = Duration(time.Second) + Minute = Duration(time.Minute) + Hour = Duration(time.Hour) + Day = Hour * 24 + Week = Day * 7 + Fortnight = Week * 2 + Month = Day * 30 // Approximation + Year = Day * 365 // Approximation + Decade = Year * 10 // Approximation + Century = Year * 100 // Approximation + Millennium = Year * 1000 // Approximation +) + +var errLeadingInt = errors.New("duration: bad [0-9]*") // never printed + +// leadingInt consumes the leading [0-9]* from s. +func leadingInt(s string) (x int64, rem string, err error) { + i := 0 + for ; i < len(s); i++ { + c := s[i] + if c < '0' || c > '9' { + break + } + if x > (1<<63-1)/10 { + // overflow + return 0, "", errLeadingInt + } + x = x*10 + int64(c) - '0' + if x < 0 { + // overflow + return 0, "", errLeadingInt + } + } + return x, s[i:], nil +} + +var unitMap = map[string]int64{ + "ns": int64(Nanosecond), + "us": int64(Microsecond), + "µs": int64(Microsecond), // U+00B5 = micro symbol + "μs": int64(Microsecond), // U+03BC = Greek letter mu + "ms": int64(Millisecond), + "s": int64(Second), + "m": int64(Minute), + "h": int64(Hour), + "d": int64(Day), + "w": int64(Week), + "y": int64(Year), // Approximation +} + +// ParseDuration parses a duration string. +// A duration string is a possibly signed sequence of +// decimal numbers, each with optional fraction and a unit suffix, +// such as "300ms", "-1.5h" or "2h45m". +// Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h", "d", "w", "y". +func ParseDuration(s string) (Duration, error) { + // [-+]?([0-9]*(\.[0-9]*)?[a-z]+)+ + orig := s + var d int64 + neg := false + + // Consume [-+]? + if s != "" { + c := s[0] + if c == '-' || c == '+' { + neg = c == '-' + s = s[1:] + } + } + // Special case: if all that is left is "0", this is zero. + if s == "0" { + return 0, nil + } + if s == "" { + return 0, errors.New("time: invalid duration " + orig) + } + for s != "" { + var ( + v, f int64 // integers before, after decimal point + scale float64 = 1 // value = v + f/scale + ) + + var err error + + // The next character must be [0-9.] + if !(s[0] == '.' || '0' <= s[0] && s[0] <= '9') { + return 0, errors.New("time: invalid duration " + orig) + } + // Consume [0-9]* + pl := len(s) + v, s, err = leadingInt(s) + if err != nil { + return 0, errors.New("time: invalid duration " + orig) + } + pre := pl != len(s) // whether we consumed anything before a period + + // Consume (\.[0-9]*)? + post := false + if s != "" && s[0] == '.' { + s = s[1:] + pl := len(s) + f, s, err = leadingInt(s) + if err != nil { + return 0, errors.New("time: invalid duration " + orig) + } + for n := pl - len(s); n > 0; n-- { + scale *= 10 + } + post = pl != len(s) + } + if !pre && !post { + // no digits (e.g. ".s" or "-.s") + return 0, errors.New("time: invalid duration " + orig) + } + + // Consume unit. + i := 0 + for ; i < len(s); i++ { + c := s[i] + if c == '.' || '0' <= c && c <= '9' { + break + } + } + if i == 0 { + return 0, errors.New("time: missing unit in duration " + orig) + } + u := s[:i] + s = s[i:] + unit, ok := unitMap[u] + if !ok { + return 0, errors.New("time: unknown unit " + u + " in duration " + orig) + } + if v > (1<<63-1)/unit { + // overflow + return 0, errors.New("time: invalid duration " + orig) + } + v *= unit + if f > 0 { + // float64 is needed to be nanosecond accurate for fractions of hours. + // v >= 0 && (f*unit/scale) <= 3.6e+12 (ns/h, h is the largest unit) + v += int64(float64(f) * (float64(unit) / scale)) + if v < 0 { + // overflow + return 0, errors.New("time: invalid duration " + orig) + } + } + d += v + if d < 0 { + // overflow + return 0, errors.New("time: invalid duration " + orig) + } + } + + if neg { + d = -d + } + return Duration(d), nil +}