forked from toolshed/abra
chore: vendor
This commit is contained in:
.gitignoremodules.txt
vendor
coopcloud.tech
dario.cat
mergo
git.coopcloud.tech
coop-cloud
github.com
AlecAivazis
survey
v2
CONTRIBUTING.mdLICENSEREADME.mdconfirm.go
core
editor.gofilter.goinput.gomultiline.gomultiselect.gopassword.gorenderer.goselect.gosurvey.goterminal
LICENSE.txtREADME.mdbuffered_reader.gocursor.gocursor_windows.godisplay.godisplay_posix.godisplay_windows.goerror.gooutput.gooutput_windows.gorunereader.gorunereader_bsd.gorunereader_linux.gorunereader_posix.gorunereader_ppc64le.gorunereader_windows.gosequences.gostdio.gosyscall_windows.goterminal.go
transform.govalidate.goAzure
go-ansiterm
BurntSushi
toml
Microsoft
go-winio
ProtonMail
go-crypto
AUTHORSCONTRIBUTORSLICENSEPATENTSkey_generation.gokeys.gokeys_test_data.go
bitcurves
brainpool
eax
internal
byteutil
ocb
openpgp
aes
keywrap
armor
canonical_text.goecdh
ecdsa
eddsa
elgamal
errors
hash.gointernal
algorithm
ecc
encoding
packet
aead_config.goaead_crypter.goaead_encrypted.gocompressed.goconfig.goencrypted_key.goliteral.gonotation.goocfb.goone_pass_signature.goopaque.gopacket.goprivate_key.goprivate_key_test_data.gopublic_key.gopublic_key_test_data.goreader.gosignature.gosymmetric_key_encrypted.gosymmetrically_encrypted.gosymmetrically_encrypted_aead.gosymmetrically_encrypted_mdc.gouserattribute.gouserid.go
read.goread_write_test_data.gos2k
write.goaymanbagabas
beorn7
perks
cenkalti
backoff
cespare
xxhash
charmbracelet
lipgloss
.gitignore.golangci-soft.yml.golangci.ymlLICENSEREADME.mdalign.goansi_unix.goansi_windows.goborders.gocolor.goget.gojoin.goposition.gorenderer.gorunes.goset.gosize.gostyle.go
table
unset.gowhitespace.golog
.gitignore.golangci.yml.goreleaser.ymlLICENSEREADME.mdcontext.goformatter.gojson.golevel.golevel_121.golevel_no121.gologfmt.gologger.gologger_121.gologger_no121.gooptions.gopkg.gostdlog.gostyles.gotext.go
x
cloudflare
containerd
containerd
log
containers
image
LICENSE
docker
cache.godocker_client.godocker_image.godocker_image_dest.godocker_image_src.godocker_transport.golookaside.go
policyconfiguration
reference
wwwauthenticate.goimage
manifest
pkg
blobinfocache
none
docker
keyctl
strslice
sysregistriesv2
tlsclientconfig
transports
types
cpuguy83
go-md2man
v2
cyphar
davecgh
decentral1se
distribution
reference
docker
cli
AUTHORSLICENSENOTICE
cli-plugins
hooks
manager
cli
cobra.go
command
cli.gocli_options.gocontext.godefaultcontextstore.gotelemetry.gotelemetry_docker.gotelemetry_options.gotelemetry_utils.gotrust.goutils.go
formatter
buildcache.gocontainer.gocontext.gocustom.godisk_usage.godisplayutils.goformatter.goimage.goreflect.go
registry.gotabwriter
volume.goservice
progress
stack
formatter
compose
interpolation
loader
schema
data
config_schema_v3.0.jsonconfig_schema_v3.1.jsonconfig_schema_v3.10.jsonconfig_schema_v3.11.jsonconfig_schema_v3.12.jsonconfig_schema_v3.13.jsonconfig_schema_v3.2.jsonconfig_schema_v3.3.jsonconfig_schema_v3.4.jsonconfig_schema_v3.5.jsonconfig_schema_v3.6.jsonconfig_schema_v3.7.jsonconfig_schema_v3.8.jsonconfig_schema_v3.9.json
schema.gotemplate
types
config
config.go
configfile
credentials
credentials.godefault_store.godefault_store_darwin.godefault_store_linux.godefault_store_unsupported.godefault_store_windows.gofile_store.gonative_store.go
types
connhelper
context
debug
error.goflags
hints
manifest
registry
required.gostreams
trust
version
opts
capabilities.goconfig.goduration.goenv.goenvfile.gofile.gogpus.gohosts.gohosts_unix.gohosts_windows.gomount.gonetwork.goopts.goparse.goport.goquotedstring.gosecret.gothrottledevice.goulimit.goweightdevice.go
templates
distribution
.dockerignore.gitignore.golangci.yml.mailmapBUILDING.mdCONTRIBUTING.mdDockerfileLICENSEMAINTAINERSMakefileREADME.mdROADMAP.mdblobs.godoc.godocker-bake.hclerrors.go
manifest
manifests.gometrics
registry.goregistry
tags.gouuid
vendor.confdocker-credential-helpers
docker
AUTHORSLICENSENOTICE
api
README.mdcommon.goswagger-gen.yamlswagger.yaml
types
blkiodev
checkpoint
client.gocontainer
change_type.gochange_types.goconfig.gocontainer.gocontainer_top.gocontainer_update.gocreate_request.gocreate_response.goerrors.goexec.gofilesystem_change.gohostconfig.gohostconfig_unix.gohostconfig_windows.gooptions.gostats.gowait_exit_error.gowait_response.gowaitcondition.go
error_response.goerror_response_ext.goevents
filters
graph_driver_data.goid_response.goimage
mount
network
plugin.goplugin_device.goplugin_env.goplugin_interface_type.goplugin_mount.goplugin_responses.goport.goregistry
strslice
swarm
common.goconfig.gocontainer.gonetwork.gonode.goruntime.go
runtime
secret.goservice.goservice_create_response.goservice_update_response.goswarm.gotask.gosystem
time
types.gotypes_deprecated.goversions
volume
client
README.mdbuild_cancel.gobuild_prune.gocheckpoint_create.gocheckpoint_delete.gocheckpoint_list.goclient.goclient_deprecated.goclient_unix.goclient_windows.goconfig_create.goconfig_inspect.goconfig_list.goconfig_remove.goconfig_update.gocontainer_attach.gocontainer_commit.gocontainer_copy.gocontainer_create.gocontainer_diff.gocontainer_exec.gocontainer_export.gocontainer_inspect.gocontainer_kill.gocontainer_list.gocontainer_logs.gocontainer_pause.gocontainer_prune.gocontainer_remove.gocontainer_rename.gocontainer_resize.gocontainer_restart.gocontainer_start.gocontainer_stats.gocontainer_stop.gocontainer_top.gocontainer_unpause.gocontainer_update.gocontainer_wait.godisk_usage.godistribution_inspect.goenvvars.goerrors.goevents.gohijack.goimage_build.goimage_create.goimage_history.goimage_import.goimage_inspect.goimage_list.goimage_load.goimage_prune.goimage_pull.goimage_push.goimage_remove.goimage_save.goimage_search.goimage_tag.goinfo.gointerface.gointerface_experimental.gointerface_stable.gologin.gonetwork_connect.gonetwork_create.gonetwork_disconnect.gonetwork_inspect.gonetwork_list.gonetwork_prune.gonetwork_remove.gonode_inspect.gonode_list.gonode_remove.gonode_update.gooptions.goping.goplugin_create.goplugin_disable.goplugin_enable.goplugin_inspect.goplugin_install.goplugin_list.goplugin_push.goplugin_remove.goplugin_set.goplugin_upgrade.gorequest.gosecret_create.gosecret_inspect.gosecret_list.gosecret_remove.gosecret_update.goservice_create.goservice_inspect.goservice_list.goservice_logs.goservice_remove.goservice_update.goswarm_get_unlock_key.goswarm_init.goswarm_inspect.goswarm_join.goswarm_leave.goswarm_unlock.goswarm_update.gotask_inspect.gotask_list.gotask_logs.goutils.goversion.govolume_create.govolume_inspect.govolume_list.govolume_prune.govolume_remove.govolume_update.go
errdefs
internal
multierror
pkg
archive
archive.goarchive_linux.goarchive_other.goarchive_unix.goarchive_windows.gochanges.gochanges_linux.gochanges_other.gochanges_unix.gochanges_windows.gocopy.gocopy_unix.gocopy_windows.godiff.godiff_unix.godiff_windows.gopath.gopath_unix.gopath_windows.gotime_linux.gotime_unsupported.gowhiteouts.gowrap.go
homedir
idtools
idtools.goidtools_unix.goidtools_windows.gousergroupadd_linux.gousergroupadd_unsupported.goutils_unix.go
ioutils
jsonmessage
pools
progress
stdcopy
streamformatter
stringid
system
args_windows.gochtimes.gochtimes_nowindows.gochtimes_windows.goerrors.gofilesys.gofilesys_unix.gofilesys_windows.goinit_windows.golstat_unix.golstat_windows.gomknod.gomknod_freebsd.gomknod_unix.gostat_bsd.gostat_darwin.gostat_illumos.gostat_linux.gostat_openbsd.gostat_unix.gostat_windows.goutimes_unix.goutimes_unsupported.goxattrs.goxattrs_linux.goxattrs_unsupported.go
registry
go-connections
LICENSE
nat
sockets
README.mdinmem_socket.goproxy.gosockets.gosockets_unix.gosockets_windows.gotcp_socket.gounix_socket.go
tlsconfig
go-metrics
CONTRIBUTING.mdLICENSELICENSE.docsNOTICEREADME.mdcounter.godocs.gogauge.gohandler.gohelpers.gonamespace.goregister.gotimer.gounit.go
go-units
go
libtrust
emirpasic
gods
felixge
httpsnoop
fvbommel
ghodss
go-git
gcfg
go-billy
v5
go-git
v5
.gitignoreCODE_OF_CONDUCT.mdCOMPATIBILITY.mdCONTRIBUTING.mdEXTENDING.mdLICENSEMakefileREADME.mdSECURITY.mdblame.gocommon.gohash.goreference.gorevision.goprune.goremote.gorepository.gosigner.gostatus.gosubmodule.goworktree.goworktree_bsd.goworktree_commit.goworktree_js.goworktree_linux.goworktree_plan9.goworktree_status.goworktree_unix_other.goworktree_windows.go
config
doc.gointernal
object_walker.gooptions.gooss-fuzz.shplumbing
cache
color
error.gofilemode
format
config
diff
gitignore
idxfile
index
objfile
packfile
common.godelta_index.godelta_selector.godiff_delta.godoc.goencoder.goerror.gofsobject.goobject_pack.gopackfile.goparser.gopatch_delta.goscanner.go
pktline
hash
memory.goobject.goobject
blob.gochange.gochange_adaptor.gocommit.gocommit_walker.gocommit_walker_bfs.gocommit_walker_bfs_filtered.gocommit_walker_ctime.gocommit_walker_limit.gocommit_walker_path.godifftree.gofile.gomerge_base.goobject.gopatch.gorename.gosignature.gotag.gotree.gotreenoder.go
protocol
packp
revlist
storer
transport
storage
filesystem
memory
storer.goutils
binary
diff
ioutil
merkletrie
sync
trace
go-logfmt
go-logr
logr
.golangci.yamlCHANGELOG.mdCONTRIBUTING.mdLICENSEREADME.mdSECURITY.mdcontext.gocontext_noslog.gocontext_slog.godiscard.go
funcr
logr.gosloghandler.goslogr.goslogsink.gostdr
go-viper
mapstructure
gogo
protobuf
AUTHORSCONTRIBUTORSLICENSE
proto
Makefileclone.gocustom_gogo.godecode.godeprecated.godiscard.goduration.goduration_gogo.goencode.goencode_gogo.goequal.goextensions.goextensions_gogo.golib.golib_gogo.gomessage_set.gopointer_reflect.gopointer_reflect_gogo.gopointer_unsafe.gopointer_unsafe_gogo.goproperties.goproperties_gogo.goskip_gogo.gotable_marshal.gotable_marshal_gogo.gotable_merge.gotable_unmarshal.gotable_unmarshal_gogo.gotext.gotext_gogo.gotext_parser.gotimestamp.gotimestamp_gogo.gowrappers.gowrappers_gogo.go
golang
google
gorilla
mux
grpc-ecosystem
grpc-gateway
hashicorp
go-cleanhttp
go-retryablehttp
inconshreveable
jbenet
kballard
go-shellquote
kevinburke
ssh_config
klauspost
compress
.gitattributes.gitignore.goreleaser.ymlLICENSEREADME.mdSECURITY.mdcompressible.gos2sx.mods2sx.sum
fse
gen.shhuff0
.gitignoreREADME.mdbitreader.gobitwriter.gocompress.godecompress.godecompress_amd64.godecompress_amd64.sdecompress_generic.gohuff0.go
internal
cpuinfo
snapref
zstd
README.mdbitreader.gobitwriter.goblockdec.goblockenc.goblocktype_string.gobytebuf.gobytereader.godecodeheader.godecoder.godecoder_options.godict.goenc_base.goenc_best.goenc_better.goenc_dfast.goenc_fast.goencoder.goencoder_options.goframedec.goframeenc.gofse_decoder.gofse_decoder_amd64.gofse_decoder_amd64.sfse_decoder_generic.gofse_encoder.gofse_predefined.gohash.gohistory.gomatchlen_amd64.gomatchlen_amd64.smatchlen_generic.goseqdec.goseqdec_amd64.goseqdec_amd64.sseqdec_generic.goseqenc.gosnappy.gozip.gozstd.go
internal
xxhash
lucasb-eyer
go-colorful
mattn
go-colorable
LICENSEREADME.mdcolorable_appengine.gocolorable_others.gocolorable_windows.gogo.test.shnoncolorable.go
go-isatty
LICENSEREADME.mddoc.gogo.test.shisatty_bsd.goisatty_others.goisatty_plan9.goisatty_solaris.goisatty_tcgets.goisatty_windows.go
go-runewidth
mgutz
miekg
pkcs11
mitchellh
colorstring
moby
docker-image-spec
patternmatcher
sys
sequential
signal
LICENSEsignal.gosignal_darwin.gosignal_freebsd.gosignal_linux.gosignal_linux_mipsx.gosignal_unix.gosignal_unsupported.gosignal_windows.go
user
term
morikuni
muesli
termenv
.gitignore.golangci-soft.yml.golangci.ymlLICENSEREADME.mdansi_compat.mdansicolors.gocolor.goconstants_linux.goconstants_solaris.goconstants_unix.gocopy.gohyperlink.gonotification.gooutput.goprofile.goscreen.gostyle.gotemplatehelper.gotermenv.gotermenv_other.gotermenv_posix.gotermenv_solaris.gotermenv_unix.gotermenv_windows.go
munnerz
goautoneg
opencontainers
go-digest
.mailmap.pullapprove.yml.travis.ymlCONTRIBUTING.mdLICENSELICENSE.docsMAINTAINERSREADME.mdalgorithm.godigest.godigester.godoc.goverifiers.go
image-spec
pjbgf
sha1cd
pkg
pmezard
go-difflib
prometheus
client_golang
LICENSENOTICE
prometheus
.gitignoreREADME.mdbuild_info_collector.gocollector.gocounter.godesc.godoc.goexpvar_collector.gofnv.gogauge.goget_pid.goget_pid_gopherjs.gogo_collector.gogo_collector_go116.gogo_collector_latest.gohistogram.go
internal
labels.gometric.gonum_threads.gonum_threads_gopherjs.goobserver.goprocess_collector.goprocess_collector_js.goprocess_collector_other.goprocess_collector_wasip1.goprocess_collector_windows.gopromhttp
registry.gosummary.gotimer.gountyped.govalue.govec.govnext.gowrap.goclient_model
common
procfs
.gitignore.golangci.ymlCODE_OF_CONDUCT.mdCONTRIBUTING.mdLICENSEMAINTAINERS.mdMakefileMakefile.commonNOTICEREADME.mdSECURITY.mdarp.gobuddyinfo.gocmdline.gocpuinfo.gocpuinfo_armx.gocpuinfo_loong64.gocpuinfo_mipsx.gocpuinfo_others.gocpuinfo_ppcx.gocpuinfo_riscvx.gocpuinfo_s390x.gocpuinfo_x86.gocrypto.godoc.gofs.gofs_statfs_notype.gofs_statfs_type.gofscache.go
internal
ipvs.gokernel_random.goloadavg.gomdstat.gomeminfo.gomountinfo.gomountstats.gonet_conntrackstat.gonet_dev.gonet_ip_socket.gonet_protocols.gonet_route.gonet_sockstat.gonet_softnet.gonet_tcp.gonet_tls_stat.gonet_udp.gonet_unix.gonet_wireless.gonet_xfrm.gonetstat.goproc.goproc_cgroup.goproc_cgroups.goproc_environ.goproc_fdinfo.goproc_interrupts.goproc_io.goproc_limits.goproc_maps.goproc_netstat.goproc_ns.goproc_psi.goproc_smaps.goproc_snmp.goproc_snmp6.goproc_stat.goproc_status.goproc_sys.goschedstat.goslab.gosoftirqs.gostat.goswaps.gothread.gottarvm.gozoneinfo.gorivo
uniseg
russross
blackfriday
schollz
sergi
go-diff
sirupsen
logrus
.gitignore.golangci.yml.travis.ymlCHANGELOG.mdLICENSEREADME.mdalt_exit.goappveyor.ymlbuffer_pool.godoc.goentry.goexported.goformatter.gohooks.gojson_formatter.gologger.gologrus.goterminal_check_appengine.goterminal_check_bsd.goterminal_check_js.goterminal_check_no_terminal.goterminal_check_notappengine.goterminal_check_solaris.goterminal_check_unix.goterminal_check_windows.gotext_formatter.gowriter.go
skeema
knownhosts
spf13
cobra
.gitignore.golangci.yml.mailmapCONDUCT.mdCONTRIBUTING.mdLICENSE.txtMAINTAINERSMakefileREADME.mdactive_help.goargs.gobash_completions.gobash_completionsV2.gocobra.gocommand.gocommand_notwin.gocommand_win.gocompletions.gofish_completions.goflag_groups.gopowershell_completions.goshell_completions.gozsh_completions.go
pflag
.gitignore.travis.ymlLICENSEREADME.mdbool.gobool_slice.gobytes.gocount.goduration.goduration_slice.goflag.gofloat32.gofloat32_slice.gofloat64.gofloat64_slice.gogolangflag.goint.goint16.goint32.goint32_slice.goint64.goint64_slice.goint8.goint_slice.goip.goip_slice.goipmask.goipnet.gostring.gostring_array.gostring_slice.gostring_to_int.gostring_to_int64.gostring_to_string.gouint.gouint16.gouint32.gouint64.gouint8.gouint_slice.go
stretchr
testify
theupdateframework
notary
.gitignoreCHANGELOG.mdCODE_OF_CONDUCT.mdCONTRIBUTING.mdCONTRIBUTORSDockerfileJenkinsfileLICENSEMAINTAINERSMAINTAINERS.ALUMNIMAINTAINERS_RULES.mdMakefileNOTARY_VERSIONREADME.mdcodecov.ymlconst.goconst_nowindows.goconst_windows.gocross.Dockerfile
client
changelist
client.godelegations.goerrors.gohelpers.gointerface.goreader.gorepo.gorepo_pkcs11.gotufclient.gowitness.gocryptoservice
development.mysql.ymldevelopment.postgresql.ymldevelopment.rethink.ymldocker-compose.postgresql.ymldocker-compose.rethink.ymldocker-compose.ymlescrow.Dockerfilefips.gonotary.gopassphrase
server.Dockerfileserver.minimal.Dockerfilesigner.Dockerfilesigner.minimal.Dockerfilestorage
trustmanager
trustpinning
tuf
urfave
cli
.flake8.gitignoreCODE_OF_CONDUCT.mdLICENSEREADME.mdapp.gocategory.gocli.gocommand.gocontext.godocs.goerrors.gofish.goflag.goflag_bool.goflag_bool_t.goflag_duration.goflag_float64.goflag_generic.goflag_int.goflag_int64.goflag_int64_slice.goflag_int_slice.goflag_string.goflag_string_slice.goflag_uint.goflag_uint64.gofuncs.gohelp.goparse.gosort.gotemplate.go
xanzy
xeipuuv
gojsonpointer
gojsonreference
gojsonschema
go.opentelemetry.io
contrib
instrumentation
net
http
otel
.codespellignore.codespellrc.gitattributes.gitignore.golangci.yml.lycheeignore.markdownlint.yamlCHANGELOG.mdCODEOWNERSCONTRIBUTING.mdLICENSEMakefileREADME.mdRELEASING.mdVERSIONING.mdget_main_pkgs.shhandler.gotrace.go
attribute
baggage
codes
doc.goerror_handler.goexporters
otlp
otlpmetric
otlpmetricgrpc
otlptrace
LICENSEREADME.mdclients.godoc.goexporter.go
internal
tracetransform
otlptracegrpc
LICENSEREADME.mdclient.godoc.goexporter.go
version.gointernal
options.gointernal
internal_logging.gometric.gometric
LICENSEREADME.mdasyncfloat64.goasyncint64.goconfig.godoc.go
propagation.goembedded
instrument.gometer.gonoop
syncfloat64.gosyncint64.gopropagation
renovate.jsonrequirements.txtsdk
LICENSEREADME.md
instrumentation
internal
metric
LICENSEREADME.mdaggregation.gocache.goconfig.godoc.goenv.goexemplar.goexporter.goinstrument.goinstrumentkind_string.go
internal
manual_reader.gometer.gometricdata
periodic_reader.gopipeline.goprovider.goreader.goversion.goview.goresource
README.mdauto.gobuiltin.goconfig.gocontainer.godoc.goenv.gohost_id.gohost_id_bsd.gohost_id_darwin.gohost_id_exec.gohost_id_linux.gohost_id_readfile.gohost_id_unsupported.gohost_id_windows.goos.goos_release_darwin.goos_release_unix.goos_unix.goos_unsupported.goos_windows.goprocess.goresource.go
trace
README.mdbatch_span_processor.godoc.goevent.goevictedqueue.goid_generator.golink.goprovider.gosampler_env.gosampling.gosimple_span_processor.gosnapshot.gospan.gospan_exporter.gospan_limits.gospan_processor.gotracer.goversion.go
version.gosemconv
v1.20.0
v1.21.0
v1.24.0
v1.26.0
trace
verify_examples.shverify_readmes.shversion.goversions.yamlproto
otlp
golang.org
x
crypto
LICENSEPATENTS
argon2
blake2b
blake2b.goblake2bAVX2_amd64.goblake2bAVX2_amd64.sblake2b_amd64.sblake2b_generic.goblake2b_ref.goblake2x.goregister.go
blowfish
cast5
chacha20
chacha_arm64.gochacha_arm64.schacha_generic.gochacha_noasm.gochacha_ppc64le.gochacha_ppc64le.schacha_s390x.gochacha_s390x.sxor.go
curve25519
ed25519
hkdf
internal
alias
poly1305
pbkdf2
sha3
doc.gohashes.gohashes_noasm.gokeccakf.gokeccakf_amd64.gokeccakf_amd64.ssha3.gosha3_s390x.gosha3_s390x.sshake.goshake_noasm.goxor.go
ssh
exp
net
LICENSEPATENTS
context
http
httpguts
http2
.gitignoreascii.gociphers.goclient_conn_pool.godatabuffer.goerrors.goflow.goframe.gogotrack.goheadermap.go
hpack
http2.gopipe.goserver.gotimer.gotransport.gowrite.gowritesched.gowritesched_priority.gowritesched_random.gowritesched_roundrobin.goidna
go118.goidna10.0.0.goidna9.0.0.gopre_go118.gopunycode.gotables10.0.0.gotables11.0.0.gotables12.0.0.gotables13.0.0.gotables15.0.0.gotables9.0.0.gotrie.gotrie12.0.0.gotrie13.0.0.gotrieval.go
internal
proxy
trace
sync
sys
LICENSEPATENTS
cpu
asm_aix_ppc64.sbyteorder.gocpu.gocpu_aix.gocpu_arm.gocpu_arm64.gocpu_arm64.scpu_gc_arm64.gocpu_gc_s390x.gocpu_gc_x86.gocpu_gccgo_arm64.gocpu_gccgo_s390x.gocpu_gccgo_x86.ccpu_gccgo_x86.gocpu_linux.gocpu_linux_arm.gocpu_linux_arm64.gocpu_linux_mips64x.gocpu_linux_noinit.gocpu_linux_ppc64x.gocpu_linux_s390x.gocpu_loong64.gocpu_mips64x.gocpu_mipsx.gocpu_netbsd_arm64.gocpu_openbsd_arm64.gocpu_openbsd_arm64.scpu_other_arm.gocpu_other_arm64.gocpu_other_mips64x.gocpu_other_ppc64x.gocpu_other_riscv64.gocpu_ppc64x.gocpu_riscv64.gocpu_s390x.gocpu_s390x.scpu_wasm.gocpu_x86.gocpu_x86.scpu_zos.gocpu_zos_s390x.goendian_big.goendian_little.gohwcap_linux.goparse.goproc_cpuinfo_linux.goruntime_auxv.goruntime_auxv_go121.gosyscall_aix_gccgo.gosyscall_aix_ppc64_gc.go
execabs
plan9
asm.sasm_plan9_386.sasm_plan9_amd64.sasm_plan9_arm.sconst_plan9.godir_plan9.goenv_plan9.goerrors_plan9.gomkall.shmkerrors.shmksysnum_plan9.shpwd_go15_plan9.gopwd_plan9.gorace.gorace0.gostr.gosyscall.gosyscall_plan9.gozsyscall_plan9_386.gozsyscall_plan9_amd64.gozsyscall_plan9_arm.gozsysnum_plan9.go
unix
.gitignoreREADME.mdaffinity_linux.goaliases.goasm_aix_ppc64.sasm_bsd_386.sasm_bsd_amd64.sasm_bsd_arm.sasm_bsd_arm64.sasm_bsd_ppc64.sasm_bsd_riscv64.sasm_linux_386.sasm_linux_amd64.sasm_linux_arm.sasm_linux_arm64.sasm_linux_loong64.sasm_linux_mips64x.sasm_linux_mipsx.sasm_linux_ppc64x.sasm_linux_riscv64.sasm_linux_s390x.sasm_openbsd_mips64.sasm_solaris_amd64.sasm_zos_s390x.sbluetooth_linux.gobpxsvc_zos.gobpxsvc_zos.scap_freebsd.goconstants.godev_aix_ppc.godev_aix_ppc64.godev_darwin.godev_dragonfly.godev_freebsd.godev_linux.godev_netbsd.godev_openbsd.godev_zos.godirent.goendian_big.goendian_little.goenv_unix.gofcntl.gofcntl_darwin.gofcntl_linux_32bit.gofdset.gogccgo.gogccgo_c.cgccgo_linux_amd64.goifreq_linux.goioctl_linux.goioctl_signed.goioctl_unsigned.goioctl_zos.gomkall.shmkerrors.shmmap_nomremap.gomremap.gopagesize_unix.gopledge_openbsd.goptrace_darwin.goptrace_ios.gorace.gorace0.goreaddirent_getdents.goreaddirent_getdirentries.gosockcmsg_dragonfly.gosockcmsg_linux.gosockcmsg_unix.gosockcmsg_unix_other.gosockcmsg_zos.gosymaddr_zos_s390x.ssyscall.gosyscall_aix.gosyscall_aix_ppc.gosyscall_aix_ppc64.gosyscall_bsd.gosyscall_darwin.gosyscall_darwin_amd64.gosyscall_darwin_arm64.gosyscall_darwin_libSystem.gosyscall_dragonfly.gosyscall_dragonfly_amd64.gosyscall_freebsd.gosyscall_freebsd_386.gosyscall_freebsd_amd64.gosyscall_freebsd_arm.gosyscall_freebsd_arm64.gosyscall_freebsd_riscv64.gosyscall_hurd.gosyscall_hurd_386.gosyscall_illumos.gosyscall_linux.gosyscall_linux_386.gosyscall_linux_alarm.gosyscall_linux_amd64.gosyscall_linux_amd64_gc.gosyscall_linux_arm.gosyscall_linux_arm64.gosyscall_linux_gc.gosyscall_linux_gc_386.gosyscall_linux_gc_arm.gosyscall_linux_gccgo_386.gosyscall_linux_gccgo_arm.gosyscall_linux_loong64.gosyscall_linux_mips64x.gosyscall_linux_mipsx.gosyscall_linux_ppc.gosyscall_linux_ppc64x.gosyscall_linux_riscv64.gosyscall_linux_s390x.gosyscall_linux_sparc64.gosyscall_netbsd.gosyscall_netbsd_386.gosyscall_netbsd_amd64.gosyscall_netbsd_arm.gosyscall_netbsd_arm64.gosyscall_openbsd.gosyscall_openbsd_386.gosyscall_openbsd_amd64.gosyscall_openbsd_arm.gosyscall_openbsd_arm64.gosyscall_openbsd_libc.gosyscall_openbsd_mips64.gosyscall_openbsd_ppc64.gosyscall_openbsd_riscv64.gosyscall_solaris.gosyscall_solaris_amd64.gosyscall_unix.gosyscall_unix_gc.gosyscall_unix_gc_ppc64x.gosyscall_zos_s390x.gosysvshm_linux.gosysvshm_unix.gosysvshm_unix_other.gotimestruct.gounveil_openbsd.goxattr_bsd.gozerrors_aix_ppc.gozerrors_aix_ppc64.gozerrors_darwin_amd64.gozerrors_darwin_arm64.gozerrors_dragonfly_amd64.gozerrors_freebsd_386.gozerrors_freebsd_amd64.gozerrors_freebsd_arm.gozerrors_freebsd_arm64.gozerrors_freebsd_riscv64.gozerrors_linux.gozerrors_linux_386.gozerrors_linux_amd64.gozerrors_linux_arm.gozerrors_linux_arm64.gozerrors_linux_loong64.gozerrors_linux_mips.gozerrors_linux_mips64.gozerrors_linux_mips64le.gozerrors_linux_mipsle.gozerrors_linux_ppc.gozerrors_linux_ppc64.gozerrors_linux_ppc64le.gozerrors_linux_riscv64.gozerrors_linux_s390x.gozerrors_linux_sparc64.gozerrors_netbsd_386.gozerrors_netbsd_amd64.gozerrors_netbsd_arm.gozerrors_netbsd_arm64.gozerrors_openbsd_386.gozerrors_openbsd_amd64.gozerrors_openbsd_arm.gozerrors_openbsd_arm64.gozerrors_openbsd_mips64.gozerrors_openbsd_ppc64.gozerrors_openbsd_riscv64.gozerrors_solaris_amd64.gozerrors_zos_s390x.gozptrace_armnn_linux.gozptrace_linux_arm64.gozptrace_mipsnn_linux.gozptrace_mipsnnle_linux.gozptrace_x86_linux.gozsymaddr_zos_s390x.szsyscall_aix_ppc.gozsyscall_aix_ppc64.gozsyscall_aix_ppc64_gc.gozsyscall_aix_ppc64_gccgo.gozsyscall_darwin_amd64.gozsyscall_darwin_amd64.szsyscall_darwin_arm64.gozsyscall_darwin_arm64.szsyscall_dragonfly_amd64.gozsyscall_freebsd_386.gozsyscall_freebsd_amd64.gozsyscall_freebsd_arm.gozsyscall_freebsd_arm64.gozsyscall_freebsd_riscv64.gozsyscall_illumos_amd64.gozsyscall_linux.gozsyscall_linux_386.gozsyscall_linux_amd64.gozsyscall_linux_arm.gozsyscall_linux_arm64.gozsyscall_linux_loong64.gozsyscall_linux_mips.gozsyscall_linux_mips64.gozsyscall_linux_mips64le.gozsyscall_linux_mipsle.gozsyscall_linux_ppc.gozsyscall_linux_ppc64.gozsyscall_linux_ppc64le.gozsyscall_linux_riscv64.gozsyscall_linux_s390x.gozsyscall_linux_sparc64.gozsyscall_netbsd_386.gozsyscall_netbsd_amd64.gozsyscall_netbsd_arm.gozsyscall_netbsd_arm64.gozsyscall_openbsd_386.gozsyscall_openbsd_386.szsyscall_openbsd_amd64.gozsyscall_openbsd_amd64.szsyscall_openbsd_arm.gozsyscall_openbsd_arm.szsyscall_openbsd_arm64.gozsyscall_openbsd_arm64.szsyscall_openbsd_mips64.gozsyscall_openbsd_mips64.szsyscall_openbsd_ppc64.gozsyscall_openbsd_ppc64.szsyscall_openbsd_riscv64.gozsyscall_openbsd_riscv64.szsyscall_solaris_amd64.gozsyscall_zos_s390x.gozsysctl_openbsd_386.gozsysctl_openbsd_amd64.gozsysctl_openbsd_arm.gozsysctl_openbsd_arm64.gozsysctl_openbsd_mips64.gozsysctl_openbsd_ppc64.gozsysctl_openbsd_riscv64.gozsysnum_darwin_amd64.gozsysnum_darwin_arm64.gozsysnum_dragonfly_amd64.gozsysnum_freebsd_386.gozsysnum_freebsd_amd64.gozsysnum_freebsd_arm.gozsysnum_freebsd_arm64.gozsysnum_freebsd_riscv64.gozsysnum_linux_386.gozsysnum_linux_amd64.gozsysnum_linux_arm.gozsysnum_linux_arm64.gozsysnum_linux_loong64.gozsysnum_linux_mips.gozsysnum_linux_mips64.gozsysnum_linux_mips64le.gozsysnum_linux_mipsle.gozsysnum_linux_ppc.gozsysnum_linux_ppc64.gozsysnum_linux_ppc64le.gozsysnum_linux_riscv64.gozsysnum_linux_s390x.gozsysnum_linux_sparc64.gozsysnum_netbsd_386.gozsysnum_netbsd_amd64.gozsysnum_netbsd_arm.gozsysnum_netbsd_arm64.gozsysnum_openbsd_386.gozsysnum_openbsd_amd64.gozsysnum_openbsd_arm.gozsysnum_openbsd_arm64.gozsysnum_openbsd_mips64.gozsysnum_openbsd_ppc64.gozsysnum_openbsd_riscv64.gozsysnum_zos_s390x.goztypes_aix_ppc.goztypes_aix_ppc64.goztypes_darwin_amd64.goztypes_darwin_arm64.goztypes_dragonfly_amd64.goztypes_freebsd_386.goztypes_freebsd_amd64.goztypes_freebsd_arm.goztypes_freebsd_arm64.goztypes_freebsd_riscv64.goztypes_linux.goztypes_linux_386.goztypes_linux_amd64.goztypes_linux_arm.goztypes_linux_arm64.goztypes_linux_loong64.goztypes_linux_mips.goztypes_linux_mips64.goztypes_linux_mips64le.goztypes_linux_mipsle.goztypes_linux_ppc.goztypes_linux_ppc64.goztypes_linux_ppc64le.goztypes_linux_riscv64.goztypes_linux_s390x.goztypes_linux_sparc64.goztypes_netbsd_386.goztypes_netbsd_amd64.goztypes_netbsd_arm.goztypes_netbsd_arm64.goztypes_openbsd_386.goztypes_openbsd_amd64.goztypes_openbsd_arm.goztypes_openbsd_arm64.goztypes_openbsd_mips64.goztypes_openbsd_ppc64.goztypes_openbsd_riscv64.goztypes_solaris_amd64.goztypes_zos_s390x.go
windows
aliases.godll_windows.goenv_windows.goeventlog.goexec_windows.gomemory_windows.gomkerrors.bashmkknownfolderids.bashmksyscall.gorace.gorace0.go
registry
security_windows.goservice.gosetupapi_windows.gostr.gosyscall.gosyscall_windows.gotypes_windows.gotypes_windows_386.gotypes_windows_amd64.gotypes_windows_arm.gotypes_windows_arm64.gozerrors_windows.gozknownfolderids_windows.gozsyscall_windows.goterm
CONTRIBUTING.mdLICENSEPATENTSREADME.mdcodereview.cfgterm.goterm_plan9.goterm_unix.goterm_unix_bsd.goterm_unix_other.goterm_unsupported.goterm_windows.goterminal.go
text
LICENSEPATENTS
cases
cases.gocontext.gofold.goicu.goinfo.gomap.gotables10.0.0.gotables11.0.0.gotables12.0.0.gotables13.0.0.gotables15.0.0.gotables9.0.0.gotrieval.go
internal
internal.go
language
match.gotag
language
secure
transform
unicode
bidi
bidi.gobracket.gocore.goprop.gotables10.0.0.gotables11.0.0.gotables12.0.0.gotables13.0.0.gotables15.0.0.gotables9.0.0.gotrieval.go
norm
width
time
google.golang.org
genproto
googleapis
grpc
AUTHORSCODE-OF-CONDUCT.mdCONTRIBUTING.mdGOVERNANCE.mdLICENSEMAINTAINERS.mdMakefileNOTICE.txtREADME.mdSECURITY.mdcall.gointerceptor.go
attributes
backoff.gobackoff
balancer
balancer_wrapper.gobinarylog
grpc_binarylog_v1
channelz
clientconn.gocodec.gocodes
connectivity
credentials
dialoptions.godoc.goencoding
grpclog
health
grpc_health_v1
internal
backoff
balancer
gracefulswitch
balancerload
binarylog
buffer
channelz
channel.gochannelmap.gofuncs.gologging.goserver.gosocket.gosubchannel.gosyscall_linux.gosyscall_nonlinux.gotrace.go
credentials
envconfig
experimental.gogrpclog
grpcsync
grpcutil
idle
internal.gometadata
pretty
resolver
serviceconfig
status
syscall
tcp_keepalive_others.gotcp_keepalive_unix.gotcp_keepalive_windows.gotransport
keepalive
metadata
peer
picker_wrapper.gopreloader.goregenerate.shresolver
resolver_wrapper.gorpc_util.goserver.goservice_config.goserviceconfig
shared_buffer_pool.gostats
status
stream.gostream_interfaces.gotap
trace.gotrace_notrace.gotrace_withtrace.goversion.goprotobuf
LICENSEPATENTS
encoding
protodelim
protojson
prototext
protowire
internal
descfmt
descopts
detrand
editiondefaults
encoding
defval
json
messageset
tag
text
errors
filedesc
filetype
flags
genid
any_gen.goapi_gen.godescriptor_gen.godoc.goduration_gen.goempty_gen.gofield_mask_gen.gogo_features_gen.gogoname.gomap_entry.gosource_context_gen.gostruct_gen.gotimestamp_gen.gotype_gen.gowrappers.gowrappers_gen.go
impl
api_export.gocheckinit.gocodec_extension.gocodec_field.gocodec_gen.gocodec_map.gocodec_map_go111.gocodec_map_go112.gocodec_message.gocodec_messageset.gocodec_reflect.gocodec_tables.gocodec_unsafe.goconvert.goconvert_list.goconvert_map.godecode.goencode.goenum.goextension.golegacy_enum.golegacy_export.golegacy_extension.golegacy_file.golegacy_message.gomerge.gomerge_gen.gomessage.gomessage_reflect.gomessage_reflect_field.gomessage_reflect_gen.gopointer_reflect.gopointer_unsafe.govalidate.goweak.go
order
pragma
set
strs
version
proto
checkinit.godecode.godecode_gen.godoc.goencode.goencode_gen.goequal.goextension.gomerge.gomessageset.goproto.goproto_methods.goproto_reflect.goreset.gosize.gosize_gen.gowrappers.go
protoadapt
reflect
protoreflect
methods.goproto.gosource.gosource_gen.gotype.govalue.govalue_equal.govalue_pure.govalue_union.govalue_unsafe_go120.govalue_unsafe_go121.go
protoregistry
runtime
types
known
anypb
durationpb
fieldmaskpb
structpb
timestamppb
wrapperspb
gopkg.in
warnings.v0
yaml.v2
.travis.ymlLICENSELICENSE.libyamlNOTICEREADME.mdapic.godecode.goemitterc.goencode.goparserc.goreaderc.goresolve.goscannerc.gosorter.gowriterc.goyaml.goyamlh.goyamlprivateh.go
yaml.v3
gotest.tools
v3
25
vendor/github.com/sergi/go-diff/AUTHORS
generated
vendored
Normal file
25
vendor/github.com/sergi/go-diff/AUTHORS
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
# This is the official list of go-diff authors for copyright purposes.
|
||||
# This file is distinct from the CONTRIBUTORS files.
|
||||
# See the latter for an explanation.
|
||||
|
||||
# Names should be added to this file as
|
||||
# Name or Organization <email address>
|
||||
# The email address is not required for organizations.
|
||||
|
||||
# Please keep the list sorted.
|
||||
|
||||
Danny Yoo <dannyyoo@google.com>
|
||||
James Kolb <jkolb@google.com>
|
||||
Jonathan Amsterdam <jba@google.com>
|
||||
Markus Zimmermann <markus.zimmermann@nethead.at> <markus.zimmermann@symflower.com> <zimmski@gmail.com>
|
||||
Matt Kovars <akaskik@gmail.com>
|
||||
Örjan Persson <orjan@spotify.com>
|
||||
Osman Masood <oamasood@gmail.com>
|
||||
Robert Carlsen <rwcarlsen@gmail.com>
|
||||
Rory Flynn <roryflynn@users.noreply.github.com>
|
||||
Sergi Mansilla <sergi.mansilla@gmail.com>
|
||||
Shatrugna Sadhu <ssadhu@apcera.com>
|
||||
Shawn Smith <shawnpsmith@gmail.com>
|
||||
Stas Maksimov <maksimov@gmail.com>
|
||||
Tor Arvid Lund <torarvid@gmail.com>
|
||||
Zac Bergquist <zbergquist99@gmail.com>
|
32
vendor/github.com/sergi/go-diff/CONTRIBUTORS
generated
vendored
Normal file
32
vendor/github.com/sergi/go-diff/CONTRIBUTORS
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
# This is the official list of people who can contribute
|
||||
# (and typically have contributed) code to the go-diff
|
||||
# repository.
|
||||
#
|
||||
# The AUTHORS file lists the copyright holders; this file
|
||||
# lists people. For example, ACME Inc. employees would be listed here
|
||||
# but not in AUTHORS, because ACME Inc. would hold the copyright.
|
||||
#
|
||||
# When adding J Random Contributor's name to this file,
|
||||
# either J's name or J's organization's name should be
|
||||
# added to the AUTHORS file.
|
||||
#
|
||||
# Names should be added to this file like so:
|
||||
# Name <email address>
|
||||
#
|
||||
# Please keep the list sorted.
|
||||
|
||||
Danny Yoo <dannyyoo@google.com>
|
||||
James Kolb <jkolb@google.com>
|
||||
Jonathan Amsterdam <jba@google.com>
|
||||
Markus Zimmermann <markus.zimmermann@nethead.at> <markus.zimmermann@symflower.com> <zimmski@gmail.com>
|
||||
Matt Kovars <akaskik@gmail.com>
|
||||
Örjan Persson <orjan@spotify.com>
|
||||
Osman Masood <oamasood@gmail.com>
|
||||
Robert Carlsen <rwcarlsen@gmail.com>
|
||||
Rory Flynn <roryflynn@users.noreply.github.com>
|
||||
Sergi Mansilla <sergi.mansilla@gmail.com>
|
||||
Shatrugna Sadhu <ssadhu@apcera.com>
|
||||
Shawn Smith <shawnpsmith@gmail.com>
|
||||
Stas Maksimov <maksimov@gmail.com>
|
||||
Tor Arvid Lund <torarvid@gmail.com>
|
||||
Zac Bergquist <zbergquist99@gmail.com>
|
20
vendor/github.com/sergi/go-diff/LICENSE
generated
vendored
Normal file
20
vendor/github.com/sergi/go-diff/LICENSE
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
Copyright (c) 2012-2016 The go-diff Authors. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
1347
vendor/github.com/sergi/go-diff/diffmatchpatch/diff.go
generated
vendored
Normal file
1347
vendor/github.com/sergi/go-diff/diffmatchpatch/diff.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
46
vendor/github.com/sergi/go-diff/diffmatchpatch/diffmatchpatch.go
generated
vendored
Normal file
46
vendor/github.com/sergi/go-diff/diffmatchpatch/diffmatchpatch.go
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
// Copyright (c) 2012-2016 The go-diff authors. All rights reserved.
|
||||
// https://github.com/sergi/go-diff
|
||||
// See the included LICENSE file for license details.
|
||||
//
|
||||
// go-diff is a Go implementation of Google's Diff, Match, and Patch library
|
||||
// Original library is Copyright (c) 2006 Google Inc.
|
||||
// http://code.google.com/p/google-diff-match-patch/
|
||||
|
||||
// Package diffmatchpatch offers robust algorithms to perform the operations required for synchronizing plain text.
|
||||
package diffmatchpatch
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// DiffMatchPatch holds the configuration for diff-match-patch operations.
|
||||
type DiffMatchPatch struct {
|
||||
// Number of seconds to map a diff before giving up (0 for infinity).
|
||||
DiffTimeout time.Duration
|
||||
// Cost of an empty edit operation in terms of edit characters.
|
||||
DiffEditCost int
|
||||
// How far to search for a match (0 = exact location, 1000+ = broad match). A match this many characters away from the expected location will add 1.0 to the score (0.0 is a perfect match).
|
||||
MatchDistance int
|
||||
// When deleting a large block of text (over ~64 characters), how close do the contents have to be to match the expected contents. (0.0 = perfection, 1.0 = very loose). Note that MatchThreshold controls how closely the end points of a delete need to match.
|
||||
PatchDeleteThreshold float64
|
||||
// Chunk size for context length.
|
||||
PatchMargin int
|
||||
// The number of bits in an int.
|
||||
MatchMaxBits int
|
||||
// At what point is no match declared (0.0 = perfection, 1.0 = very loose).
|
||||
MatchThreshold float64
|
||||
}
|
||||
|
||||
// New creates a new DiffMatchPatch object with default parameters.
|
||||
func New() *DiffMatchPatch {
|
||||
// Defaults.
|
||||
return &DiffMatchPatch{
|
||||
DiffTimeout: time.Second,
|
||||
DiffEditCost: 4,
|
||||
MatchThreshold: 0.5,
|
||||
MatchDistance: 1000,
|
||||
PatchDeleteThreshold: 0.5,
|
||||
PatchMargin: 4,
|
||||
MatchMaxBits: 32,
|
||||
}
|
||||
}
|
160
vendor/github.com/sergi/go-diff/diffmatchpatch/match.go
generated
vendored
Normal file
160
vendor/github.com/sergi/go-diff/diffmatchpatch/match.go
generated
vendored
Normal file
@ -0,0 +1,160 @@
|
||||
// Copyright (c) 2012-2016 The go-diff authors. All rights reserved.
|
||||
// https://github.com/sergi/go-diff
|
||||
// See the included LICENSE file for license details.
|
||||
//
|
||||
// go-diff is a Go implementation of Google's Diff, Match, and Patch library
|
||||
// Original library is Copyright (c) 2006 Google Inc.
|
||||
// http://code.google.com/p/google-diff-match-patch/
|
||||
|
||||
package diffmatchpatch
|
||||
|
||||
import (
|
||||
"math"
|
||||
)
|
||||
|
||||
// MatchMain locates the best instance of 'pattern' in 'text' near 'loc'.
|
||||
// Returns -1 if no match found.
|
||||
func (dmp *DiffMatchPatch) MatchMain(text, pattern string, loc int) int {
|
||||
// Check for null inputs not needed since null can't be passed in C#.
|
||||
|
||||
loc = int(math.Max(0, math.Min(float64(loc), float64(len(text)))))
|
||||
if text == pattern {
|
||||
// Shortcut (potentially not guaranteed by the algorithm)
|
||||
return 0
|
||||
} else if len(text) == 0 {
|
||||
// Nothing to match.
|
||||
return -1
|
||||
} else if loc+len(pattern) <= len(text) && text[loc:loc+len(pattern)] == pattern {
|
||||
// Perfect match at the perfect spot! (Includes case of null pattern)
|
||||
return loc
|
||||
}
|
||||
// Do a fuzzy compare.
|
||||
return dmp.MatchBitap(text, pattern, loc)
|
||||
}
|
||||
|
||||
// MatchBitap locates the best instance of 'pattern' in 'text' near 'loc' using the Bitap algorithm.
|
||||
// Returns -1 if no match was found.
|
||||
func (dmp *DiffMatchPatch) MatchBitap(text, pattern string, loc int) int {
|
||||
// Initialise the alphabet.
|
||||
s := dmp.MatchAlphabet(pattern)
|
||||
|
||||
// Highest score beyond which we give up.
|
||||
scoreThreshold := dmp.MatchThreshold
|
||||
// Is there a nearby exact match? (speedup)
|
||||
bestLoc := indexOf(text, pattern, loc)
|
||||
if bestLoc != -1 {
|
||||
scoreThreshold = math.Min(dmp.matchBitapScore(0, bestLoc, loc,
|
||||
pattern), scoreThreshold)
|
||||
// What about in the other direction? (speedup)
|
||||
bestLoc = lastIndexOf(text, pattern, loc+len(pattern))
|
||||
if bestLoc != -1 {
|
||||
scoreThreshold = math.Min(dmp.matchBitapScore(0, bestLoc, loc,
|
||||
pattern), scoreThreshold)
|
||||
}
|
||||
}
|
||||
|
||||
// Initialise the bit arrays.
|
||||
matchmask := 1 << uint((len(pattern) - 1))
|
||||
bestLoc = -1
|
||||
|
||||
var binMin, binMid int
|
||||
binMax := len(pattern) + len(text)
|
||||
lastRd := []int{}
|
||||
for d := 0; d < len(pattern); d++ {
|
||||
// Scan for the best match; each iteration allows for one more error. Run a binary search to determine how far from 'loc' we can stray at this error level.
|
||||
binMin = 0
|
||||
binMid = binMax
|
||||
for binMin < binMid {
|
||||
if dmp.matchBitapScore(d, loc+binMid, loc, pattern) <= scoreThreshold {
|
||||
binMin = binMid
|
||||
} else {
|
||||
binMax = binMid
|
||||
}
|
||||
binMid = (binMax-binMin)/2 + binMin
|
||||
}
|
||||
// Use the result from this iteration as the maximum for the next.
|
||||
binMax = binMid
|
||||
start := int(math.Max(1, float64(loc-binMid+1)))
|
||||
finish := int(math.Min(float64(loc+binMid), float64(len(text))) + float64(len(pattern)))
|
||||
|
||||
rd := make([]int, finish+2)
|
||||
rd[finish+1] = (1 << uint(d)) - 1
|
||||
|
||||
for j := finish; j >= start; j-- {
|
||||
var charMatch int
|
||||
if len(text) <= j-1 {
|
||||
// Out of range.
|
||||
charMatch = 0
|
||||
} else if _, ok := s[text[j-1]]; !ok {
|
||||
charMatch = 0
|
||||
} else {
|
||||
charMatch = s[text[j-1]]
|
||||
}
|
||||
|
||||
if d == 0 {
|
||||
// First pass: exact match.
|
||||
rd[j] = ((rd[j+1] << 1) | 1) & charMatch
|
||||
} else {
|
||||
// Subsequent passes: fuzzy match.
|
||||
rd[j] = ((rd[j+1]<<1)|1)&charMatch | (((lastRd[j+1] | lastRd[j]) << 1) | 1) | lastRd[j+1]
|
||||
}
|
||||
if (rd[j] & matchmask) != 0 {
|
||||
score := dmp.matchBitapScore(d, j-1, loc, pattern)
|
||||
// This match will almost certainly be better than any existing match. But check anyway.
|
||||
if score <= scoreThreshold {
|
||||
// Told you so.
|
||||
scoreThreshold = score
|
||||
bestLoc = j - 1
|
||||
if bestLoc > loc {
|
||||
// When passing loc, don't exceed our current distance from loc.
|
||||
start = int(math.Max(1, float64(2*loc-bestLoc)))
|
||||
} else {
|
||||
// Already passed loc, downhill from here on in.
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if dmp.matchBitapScore(d+1, loc, loc, pattern) > scoreThreshold {
|
||||
// No hope for a (better) match at greater error levels.
|
||||
break
|
||||
}
|
||||
lastRd = rd
|
||||
}
|
||||
return bestLoc
|
||||
}
|
||||
|
||||
// matchBitapScore computes and returns the score for a match with e errors and x location.
|
||||
func (dmp *DiffMatchPatch) matchBitapScore(e, x, loc int, pattern string) float64 {
|
||||
accuracy := float64(e) / float64(len(pattern))
|
||||
proximity := math.Abs(float64(loc - x))
|
||||
if dmp.MatchDistance == 0 {
|
||||
// Dodge divide by zero error.
|
||||
if proximity == 0 {
|
||||
return accuracy
|
||||
}
|
||||
|
||||
return 1.0
|
||||
}
|
||||
return accuracy + (proximity / float64(dmp.MatchDistance))
|
||||
}
|
||||
|
||||
// MatchAlphabet initialises the alphabet for the Bitap algorithm.
|
||||
func (dmp *DiffMatchPatch) MatchAlphabet(pattern string) map[byte]int {
|
||||
s := map[byte]int{}
|
||||
charPattern := []byte(pattern)
|
||||
for _, c := range charPattern {
|
||||
_, ok := s[c]
|
||||
if !ok {
|
||||
s[c] = 0
|
||||
}
|
||||
}
|
||||
i := 0
|
||||
|
||||
for _, c := range charPattern {
|
||||
value := s[c] | int(uint(1)<<uint((len(pattern)-i-1)))
|
||||
s[c] = value
|
||||
i++
|
||||
}
|
||||
return s
|
||||
}
|
23
vendor/github.com/sergi/go-diff/diffmatchpatch/mathutil.go
generated
vendored
Normal file
23
vendor/github.com/sergi/go-diff/diffmatchpatch/mathutil.go
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
// Copyright (c) 2012-2016 The go-diff authors. All rights reserved.
|
||||
// https://github.com/sergi/go-diff
|
||||
// See the included LICENSE file for license details.
|
||||
//
|
||||
// go-diff is a Go implementation of Google's Diff, Match, and Patch library
|
||||
// Original library is Copyright (c) 2006 Google Inc.
|
||||
// http://code.google.com/p/google-diff-match-patch/
|
||||
|
||||
package diffmatchpatch
|
||||
|
||||
func min(x, y int) int {
|
||||
if x < y {
|
||||
return x
|
||||
}
|
||||
return y
|
||||
}
|
||||
|
||||
func max(x, y int) int {
|
||||
if x > y {
|
||||
return x
|
||||
}
|
||||
return y
|
||||
}
|
17
vendor/github.com/sergi/go-diff/diffmatchpatch/operation_string.go
generated
vendored
Normal file
17
vendor/github.com/sergi/go-diff/diffmatchpatch/operation_string.go
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
// Code generated by "stringer -type=Operation -trimprefix=Diff"; DO NOT EDIT.
|
||||
|
||||
package diffmatchpatch
|
||||
|
||||
import "fmt"
|
||||
|
||||
const _Operation_name = "DeleteEqualInsert"
|
||||
|
||||
var _Operation_index = [...]uint8{0, 6, 11, 17}
|
||||
|
||||
func (i Operation) String() string {
|
||||
i -= -1
|
||||
if i < 0 || i >= Operation(len(_Operation_index)-1) {
|
||||
return fmt.Sprintf("Operation(%d)", i+-1)
|
||||
}
|
||||
return _Operation_name[_Operation_index[i]:_Operation_index[i+1]]
|
||||
}
|
556
vendor/github.com/sergi/go-diff/diffmatchpatch/patch.go
generated
vendored
Normal file
556
vendor/github.com/sergi/go-diff/diffmatchpatch/patch.go
generated
vendored
Normal file
@ -0,0 +1,556 @@
|
||||
// Copyright (c) 2012-2016 The go-diff authors. All rights reserved.
|
||||
// https://github.com/sergi/go-diff
|
||||
// See the included LICENSE file for license details.
|
||||
//
|
||||
// go-diff is a Go implementation of Google's Diff, Match, and Patch library
|
||||
// Original library is Copyright (c) 2006 Google Inc.
|
||||
// http://code.google.com/p/google-diff-match-patch/
|
||||
|
||||
package diffmatchpatch
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"math"
|
||||
"net/url"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Patch represents one patch operation.
|
||||
type Patch struct {
|
||||
diffs []Diff
|
||||
Start1 int
|
||||
Start2 int
|
||||
Length1 int
|
||||
Length2 int
|
||||
}
|
||||
|
||||
// String emulates GNU diff's format.
|
||||
// Header: @@ -382,8 +481,9 @@
|
||||
// Indices are printed as 1-based, not 0-based.
|
||||
func (p *Patch) String() string {
|
||||
var coords1, coords2 string
|
||||
|
||||
if p.Length1 == 0 {
|
||||
coords1 = strconv.Itoa(p.Start1) + ",0"
|
||||
} else if p.Length1 == 1 {
|
||||
coords1 = strconv.Itoa(p.Start1 + 1)
|
||||
} else {
|
||||
coords1 = strconv.Itoa(p.Start1+1) + "," + strconv.Itoa(p.Length1)
|
||||
}
|
||||
|
||||
if p.Length2 == 0 {
|
||||
coords2 = strconv.Itoa(p.Start2) + ",0"
|
||||
} else if p.Length2 == 1 {
|
||||
coords2 = strconv.Itoa(p.Start2 + 1)
|
||||
} else {
|
||||
coords2 = strconv.Itoa(p.Start2+1) + "," + strconv.Itoa(p.Length2)
|
||||
}
|
||||
|
||||
var text bytes.Buffer
|
||||
_, _ = text.WriteString("@@ -" + coords1 + " +" + coords2 + " @@\n")
|
||||
|
||||
// Escape the body of the patch with %xx notation.
|
||||
for _, aDiff := range p.diffs {
|
||||
switch aDiff.Type {
|
||||
case DiffInsert:
|
||||
_, _ = text.WriteString("+")
|
||||
case DiffDelete:
|
||||
_, _ = text.WriteString("-")
|
||||
case DiffEqual:
|
||||
_, _ = text.WriteString(" ")
|
||||
}
|
||||
|
||||
_, _ = text.WriteString(strings.Replace(url.QueryEscape(aDiff.Text), "+", " ", -1))
|
||||
_, _ = text.WriteString("\n")
|
||||
}
|
||||
|
||||
return unescaper.Replace(text.String())
|
||||
}
|
||||
|
||||
// PatchAddContext increases the context until it is unique, but doesn't let the pattern expand beyond MatchMaxBits.
|
||||
func (dmp *DiffMatchPatch) PatchAddContext(patch Patch, text string) Patch {
|
||||
if len(text) == 0 {
|
||||
return patch
|
||||
}
|
||||
|
||||
pattern := text[patch.Start2 : patch.Start2+patch.Length1]
|
||||
padding := 0
|
||||
|
||||
// Look for the first and last matches of pattern in text. If two different matches are found, increase the pattern length.
|
||||
for strings.Index(text, pattern) != strings.LastIndex(text, pattern) &&
|
||||
len(pattern) < dmp.MatchMaxBits-2*dmp.PatchMargin {
|
||||
padding += dmp.PatchMargin
|
||||
maxStart := max(0, patch.Start2-padding)
|
||||
minEnd := min(len(text), patch.Start2+patch.Length1+padding)
|
||||
pattern = text[maxStart:minEnd]
|
||||
}
|
||||
// Add one chunk for good luck.
|
||||
padding += dmp.PatchMargin
|
||||
|
||||
// Add the prefix.
|
||||
prefix := text[max(0, patch.Start2-padding):patch.Start2]
|
||||
if len(prefix) != 0 {
|
||||
patch.diffs = append([]Diff{{DiffEqual, prefix}}, patch.diffs...)
|
||||
}
|
||||
// Add the suffix.
|
||||
suffix := text[patch.Start2+patch.Length1 : min(len(text), patch.Start2+patch.Length1+padding)]
|
||||
if len(suffix) != 0 {
|
||||
patch.diffs = append(patch.diffs, Diff{DiffEqual, suffix})
|
||||
}
|
||||
|
||||
// Roll back the start points.
|
||||
patch.Start1 -= len(prefix)
|
||||
patch.Start2 -= len(prefix)
|
||||
// Extend the lengths.
|
||||
patch.Length1 += len(prefix) + len(suffix)
|
||||
patch.Length2 += len(prefix) + len(suffix)
|
||||
|
||||
return patch
|
||||
}
|
||||
|
||||
// PatchMake computes a list of patches.
|
||||
func (dmp *DiffMatchPatch) PatchMake(opt ...interface{}) []Patch {
|
||||
if len(opt) == 1 {
|
||||
diffs, _ := opt[0].([]Diff)
|
||||
text1 := dmp.DiffText1(diffs)
|
||||
return dmp.PatchMake(text1, diffs)
|
||||
} else if len(opt) == 2 {
|
||||
text1 := opt[0].(string)
|
||||
switch t := opt[1].(type) {
|
||||
case string:
|
||||
diffs := dmp.DiffMain(text1, t, true)
|
||||
if len(diffs) > 2 {
|
||||
diffs = dmp.DiffCleanupSemantic(diffs)
|
||||
diffs = dmp.DiffCleanupEfficiency(diffs)
|
||||
}
|
||||
return dmp.PatchMake(text1, diffs)
|
||||
case []Diff:
|
||||
return dmp.patchMake2(text1, t)
|
||||
}
|
||||
} else if len(opt) == 3 {
|
||||
return dmp.PatchMake(opt[0], opt[2])
|
||||
}
|
||||
return []Patch{}
|
||||
}
|
||||
|
||||
// patchMake2 computes a list of patches to turn text1 into text2.
|
||||
// text2 is not provided, diffs are the delta between text1 and text2.
|
||||
func (dmp *DiffMatchPatch) patchMake2(text1 string, diffs []Diff) []Patch {
|
||||
// Check for null inputs not needed since null can't be passed in C#.
|
||||
patches := []Patch{}
|
||||
if len(diffs) == 0 {
|
||||
return patches // Get rid of the null case.
|
||||
}
|
||||
|
||||
patch := Patch{}
|
||||
charCount1 := 0 // Number of characters into the text1 string.
|
||||
charCount2 := 0 // Number of characters into the text2 string.
|
||||
// Start with text1 (prepatchText) and apply the diffs until we arrive at text2 (postpatchText). We recreate the patches one by one to determine context info.
|
||||
prepatchText := text1
|
||||
postpatchText := text1
|
||||
|
||||
for i, aDiff := range diffs {
|
||||
if len(patch.diffs) == 0 && aDiff.Type != DiffEqual {
|
||||
// A new patch starts here.
|
||||
patch.Start1 = charCount1
|
||||
patch.Start2 = charCount2
|
||||
}
|
||||
|
||||
switch aDiff.Type {
|
||||
case DiffInsert:
|
||||
patch.diffs = append(patch.diffs, aDiff)
|
||||
patch.Length2 += len(aDiff.Text)
|
||||
postpatchText = postpatchText[:charCount2] +
|
||||
aDiff.Text + postpatchText[charCount2:]
|
||||
case DiffDelete:
|
||||
patch.Length1 += len(aDiff.Text)
|
||||
patch.diffs = append(patch.diffs, aDiff)
|
||||
postpatchText = postpatchText[:charCount2] + postpatchText[charCount2+len(aDiff.Text):]
|
||||
case DiffEqual:
|
||||
if len(aDiff.Text) <= 2*dmp.PatchMargin &&
|
||||
len(patch.diffs) != 0 && i != len(diffs)-1 {
|
||||
// Small equality inside a patch.
|
||||
patch.diffs = append(patch.diffs, aDiff)
|
||||
patch.Length1 += len(aDiff.Text)
|
||||
patch.Length2 += len(aDiff.Text)
|
||||
}
|
||||
if len(aDiff.Text) >= 2*dmp.PatchMargin {
|
||||
// Time for a new patch.
|
||||
if len(patch.diffs) != 0 {
|
||||
patch = dmp.PatchAddContext(patch, prepatchText)
|
||||
patches = append(patches, patch)
|
||||
patch = Patch{}
|
||||
// Unlike Unidiff, our patch lists have a rolling context. http://code.google.com/p/google-diff-match-patch/wiki/Unidiff Update prepatch text & pos to reflect the application of the just completed patch.
|
||||
prepatchText = postpatchText
|
||||
charCount1 = charCount2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update the current character count.
|
||||
if aDiff.Type != DiffInsert {
|
||||
charCount1 += len(aDiff.Text)
|
||||
}
|
||||
if aDiff.Type != DiffDelete {
|
||||
charCount2 += len(aDiff.Text)
|
||||
}
|
||||
}
|
||||
|
||||
// Pick up the leftover patch if not empty.
|
||||
if len(patch.diffs) != 0 {
|
||||
patch = dmp.PatchAddContext(patch, prepatchText)
|
||||
patches = append(patches, patch)
|
||||
}
|
||||
|
||||
return patches
|
||||
}
|
||||
|
||||
// PatchDeepCopy returns an array that is identical to a given an array of patches.
|
||||
func (dmp *DiffMatchPatch) PatchDeepCopy(patches []Patch) []Patch {
|
||||
patchesCopy := []Patch{}
|
||||
for _, aPatch := range patches {
|
||||
patchCopy := Patch{}
|
||||
for _, aDiff := range aPatch.diffs {
|
||||
patchCopy.diffs = append(patchCopy.diffs, Diff{
|
||||
aDiff.Type,
|
||||
aDiff.Text,
|
||||
})
|
||||
}
|
||||
patchCopy.Start1 = aPatch.Start1
|
||||
patchCopy.Start2 = aPatch.Start2
|
||||
patchCopy.Length1 = aPatch.Length1
|
||||
patchCopy.Length2 = aPatch.Length2
|
||||
patchesCopy = append(patchesCopy, patchCopy)
|
||||
}
|
||||
return patchesCopy
|
||||
}
|
||||
|
||||
// PatchApply merges a set of patches onto the text. Returns a patched text, as well as an array of true/false values indicating which patches were applied.
|
||||
func (dmp *DiffMatchPatch) PatchApply(patches []Patch, text string) (string, []bool) {
|
||||
if len(patches) == 0 {
|
||||
return text, []bool{}
|
||||
}
|
||||
|
||||
// Deep copy the patches so that no changes are made to originals.
|
||||
patches = dmp.PatchDeepCopy(patches)
|
||||
|
||||
nullPadding := dmp.PatchAddPadding(patches)
|
||||
text = nullPadding + text + nullPadding
|
||||
patches = dmp.PatchSplitMax(patches)
|
||||
|
||||
x := 0
|
||||
// delta keeps track of the offset between the expected and actual location of the previous patch. If there are patches expected at positions 10 and 20, but the first patch was found at 12, delta is 2 and the second patch has an effective expected position of 22.
|
||||
delta := 0
|
||||
results := make([]bool, len(patches))
|
||||
for _, aPatch := range patches {
|
||||
expectedLoc := aPatch.Start2 + delta
|
||||
text1 := dmp.DiffText1(aPatch.diffs)
|
||||
var startLoc int
|
||||
endLoc := -1
|
||||
if len(text1) > dmp.MatchMaxBits {
|
||||
// PatchSplitMax will only provide an oversized pattern in the case of a monster delete.
|
||||
startLoc = dmp.MatchMain(text, text1[:dmp.MatchMaxBits], expectedLoc)
|
||||
if startLoc != -1 {
|
||||
endLoc = dmp.MatchMain(text,
|
||||
text1[len(text1)-dmp.MatchMaxBits:], expectedLoc+len(text1)-dmp.MatchMaxBits)
|
||||
if endLoc == -1 || startLoc >= endLoc {
|
||||
// Can't find valid trailing context. Drop this patch.
|
||||
startLoc = -1
|
||||
}
|
||||
}
|
||||
} else {
|
||||
startLoc = dmp.MatchMain(text, text1, expectedLoc)
|
||||
}
|
||||
if startLoc == -1 {
|
||||
// No match found. :(
|
||||
results[x] = false
|
||||
// Subtract the delta for this failed patch from subsequent patches.
|
||||
delta -= aPatch.Length2 - aPatch.Length1
|
||||
} else {
|
||||
// Found a match. :)
|
||||
results[x] = true
|
||||
delta = startLoc - expectedLoc
|
||||
var text2 string
|
||||
if endLoc == -1 {
|
||||
text2 = text[startLoc:int(math.Min(float64(startLoc+len(text1)), float64(len(text))))]
|
||||
} else {
|
||||
text2 = text[startLoc:int(math.Min(float64(endLoc+dmp.MatchMaxBits), float64(len(text))))]
|
||||
}
|
||||
if text1 == text2 {
|
||||
// Perfect match, just shove the Replacement text in.
|
||||
text = text[:startLoc] + dmp.DiffText2(aPatch.diffs) + text[startLoc+len(text1):]
|
||||
} else {
|
||||
// Imperfect match. Run a diff to get a framework of equivalent indices.
|
||||
diffs := dmp.DiffMain(text1, text2, false)
|
||||
if len(text1) > dmp.MatchMaxBits && float64(dmp.DiffLevenshtein(diffs))/float64(len(text1)) > dmp.PatchDeleteThreshold {
|
||||
// The end points match, but the content is unacceptably bad.
|
||||
results[x] = false
|
||||
} else {
|
||||
diffs = dmp.DiffCleanupSemanticLossless(diffs)
|
||||
index1 := 0
|
||||
for _, aDiff := range aPatch.diffs {
|
||||
if aDiff.Type != DiffEqual {
|
||||
index2 := dmp.DiffXIndex(diffs, index1)
|
||||
if aDiff.Type == DiffInsert {
|
||||
// Insertion
|
||||
text = text[:startLoc+index2] + aDiff.Text + text[startLoc+index2:]
|
||||
} else if aDiff.Type == DiffDelete {
|
||||
// Deletion
|
||||
startIndex := startLoc + index2
|
||||
text = text[:startIndex] +
|
||||
text[startIndex+dmp.DiffXIndex(diffs, index1+len(aDiff.Text))-index2:]
|
||||
}
|
||||
}
|
||||
if aDiff.Type != DiffDelete {
|
||||
index1 += len(aDiff.Text)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
x++
|
||||
}
|
||||
// Strip the padding off.
|
||||
text = text[len(nullPadding) : len(nullPadding)+(len(text)-2*len(nullPadding))]
|
||||
return text, results
|
||||
}
|
||||
|
||||
// PatchAddPadding adds some padding on text start and end so that edges can match something.
|
||||
// Intended to be called only from within patchApply.
|
||||
func (dmp *DiffMatchPatch) PatchAddPadding(patches []Patch) string {
|
||||
paddingLength := dmp.PatchMargin
|
||||
nullPadding := ""
|
||||
for x := 1; x <= paddingLength; x++ {
|
||||
nullPadding += string(rune(x))
|
||||
}
|
||||
|
||||
// Bump all the patches forward.
|
||||
for i := range patches {
|
||||
patches[i].Start1 += paddingLength
|
||||
patches[i].Start2 += paddingLength
|
||||
}
|
||||
|
||||
// Add some padding on start of first diff.
|
||||
if len(patches[0].diffs) == 0 || patches[0].diffs[0].Type != DiffEqual {
|
||||
// Add nullPadding equality.
|
||||
patches[0].diffs = append([]Diff{{DiffEqual, nullPadding}}, patches[0].diffs...)
|
||||
patches[0].Start1 -= paddingLength // Should be 0.
|
||||
patches[0].Start2 -= paddingLength // Should be 0.
|
||||
patches[0].Length1 += paddingLength
|
||||
patches[0].Length2 += paddingLength
|
||||
} else if paddingLength > len(patches[0].diffs[0].Text) {
|
||||
// Grow first equality.
|
||||
extraLength := paddingLength - len(patches[0].diffs[0].Text)
|
||||
patches[0].diffs[0].Text = nullPadding[len(patches[0].diffs[0].Text):] + patches[0].diffs[0].Text
|
||||
patches[0].Start1 -= extraLength
|
||||
patches[0].Start2 -= extraLength
|
||||
patches[0].Length1 += extraLength
|
||||
patches[0].Length2 += extraLength
|
||||
}
|
||||
|
||||
// Add some padding on end of last diff.
|
||||
last := len(patches) - 1
|
||||
if len(patches[last].diffs) == 0 || patches[last].diffs[len(patches[last].diffs)-1].Type != DiffEqual {
|
||||
// Add nullPadding equality.
|
||||
patches[last].diffs = append(patches[last].diffs, Diff{DiffEqual, nullPadding})
|
||||
patches[last].Length1 += paddingLength
|
||||
patches[last].Length2 += paddingLength
|
||||
} else if paddingLength > len(patches[last].diffs[len(patches[last].diffs)-1].Text) {
|
||||
// Grow last equality.
|
||||
lastDiff := patches[last].diffs[len(patches[last].diffs)-1]
|
||||
extraLength := paddingLength - len(lastDiff.Text)
|
||||
patches[last].diffs[len(patches[last].diffs)-1].Text += nullPadding[:extraLength]
|
||||
patches[last].Length1 += extraLength
|
||||
patches[last].Length2 += extraLength
|
||||
}
|
||||
|
||||
return nullPadding
|
||||
}
|
||||
|
||||
// PatchSplitMax looks through the patches and breaks up any which are longer than the maximum limit of the match algorithm.
|
||||
// Intended to be called only from within patchApply.
|
||||
func (dmp *DiffMatchPatch) PatchSplitMax(patches []Patch) []Patch {
|
||||
patchSize := dmp.MatchMaxBits
|
||||
for x := 0; x < len(patches); x++ {
|
||||
if patches[x].Length1 <= patchSize {
|
||||
continue
|
||||
}
|
||||
bigpatch := patches[x]
|
||||
// Remove the big old patch.
|
||||
patches = append(patches[:x], patches[x+1:]...)
|
||||
x--
|
||||
|
||||
Start1 := bigpatch.Start1
|
||||
Start2 := bigpatch.Start2
|
||||
precontext := ""
|
||||
for len(bigpatch.diffs) != 0 {
|
||||
// Create one of several smaller patches.
|
||||
patch := Patch{}
|
||||
empty := true
|
||||
patch.Start1 = Start1 - len(precontext)
|
||||
patch.Start2 = Start2 - len(precontext)
|
||||
if len(precontext) != 0 {
|
||||
patch.Length1 = len(precontext)
|
||||
patch.Length2 = len(precontext)
|
||||
patch.diffs = append(patch.diffs, Diff{DiffEqual, precontext})
|
||||
}
|
||||
for len(bigpatch.diffs) != 0 && patch.Length1 < patchSize-dmp.PatchMargin {
|
||||
diffType := bigpatch.diffs[0].Type
|
||||
diffText := bigpatch.diffs[0].Text
|
||||
if diffType == DiffInsert {
|
||||
// Insertions are harmless.
|
||||
patch.Length2 += len(diffText)
|
||||
Start2 += len(diffText)
|
||||
patch.diffs = append(patch.diffs, bigpatch.diffs[0])
|
||||
bigpatch.diffs = bigpatch.diffs[1:]
|
||||
empty = false
|
||||
} else if diffType == DiffDelete && len(patch.diffs) == 1 && patch.diffs[0].Type == DiffEqual && len(diffText) > 2*patchSize {
|
||||
// This is a large deletion. Let it pass in one chunk.
|
||||
patch.Length1 += len(diffText)
|
||||
Start1 += len(diffText)
|
||||
empty = false
|
||||
patch.diffs = append(patch.diffs, Diff{diffType, diffText})
|
||||
bigpatch.diffs = bigpatch.diffs[1:]
|
||||
} else {
|
||||
// Deletion or equality. Only take as much as we can stomach.
|
||||
diffText = diffText[:min(len(diffText), patchSize-patch.Length1-dmp.PatchMargin)]
|
||||
|
||||
patch.Length1 += len(diffText)
|
||||
Start1 += len(diffText)
|
||||
if diffType == DiffEqual {
|
||||
patch.Length2 += len(diffText)
|
||||
Start2 += len(diffText)
|
||||
} else {
|
||||
empty = false
|
||||
}
|
||||
patch.diffs = append(patch.diffs, Diff{diffType, diffText})
|
||||
if diffText == bigpatch.diffs[0].Text {
|
||||
bigpatch.diffs = bigpatch.diffs[1:]
|
||||
} else {
|
||||
bigpatch.diffs[0].Text =
|
||||
bigpatch.diffs[0].Text[len(diffText):]
|
||||
}
|
||||
}
|
||||
}
|
||||
// Compute the head context for the next patch.
|
||||
precontext = dmp.DiffText2(patch.diffs)
|
||||
precontext = precontext[max(0, len(precontext)-dmp.PatchMargin):]
|
||||
|
||||
postcontext := ""
|
||||
// Append the end context for this patch.
|
||||
if len(dmp.DiffText1(bigpatch.diffs)) > dmp.PatchMargin {
|
||||
postcontext = dmp.DiffText1(bigpatch.diffs)[:dmp.PatchMargin]
|
||||
} else {
|
||||
postcontext = dmp.DiffText1(bigpatch.diffs)
|
||||
}
|
||||
|
||||
if len(postcontext) != 0 {
|
||||
patch.Length1 += len(postcontext)
|
||||
patch.Length2 += len(postcontext)
|
||||
if len(patch.diffs) != 0 && patch.diffs[len(patch.diffs)-1].Type == DiffEqual {
|
||||
patch.diffs[len(patch.diffs)-1].Text += postcontext
|
||||
} else {
|
||||
patch.diffs = append(patch.diffs, Diff{DiffEqual, postcontext})
|
||||
}
|
||||
}
|
||||
if !empty {
|
||||
x++
|
||||
patches = append(patches[:x], append([]Patch{patch}, patches[x:]...)...)
|
||||
}
|
||||
}
|
||||
}
|
||||
return patches
|
||||
}
|
||||
|
||||
// PatchToText takes a list of patches and returns a textual representation.
|
||||
func (dmp *DiffMatchPatch) PatchToText(patches []Patch) string {
|
||||
var text bytes.Buffer
|
||||
for _, aPatch := range patches {
|
||||
_, _ = text.WriteString(aPatch.String())
|
||||
}
|
||||
return text.String()
|
||||
}
|
||||
|
||||
// PatchFromText parses a textual representation of patches and returns a List of Patch objects.
|
||||
func (dmp *DiffMatchPatch) PatchFromText(textline string) ([]Patch, error) {
|
||||
patches := []Patch{}
|
||||
if len(textline) == 0 {
|
||||
return patches, nil
|
||||
}
|
||||
text := strings.Split(textline, "\n")
|
||||
textPointer := 0
|
||||
patchHeader := regexp.MustCompile("^@@ -(\\d+),?(\\d*) \\+(\\d+),?(\\d*) @@$")
|
||||
|
||||
var patch Patch
|
||||
var sign uint8
|
||||
var line string
|
||||
for textPointer < len(text) {
|
||||
|
||||
if !patchHeader.MatchString(text[textPointer]) {
|
||||
return patches, errors.New("Invalid patch string: " + text[textPointer])
|
||||
}
|
||||
|
||||
patch = Patch{}
|
||||
m := patchHeader.FindStringSubmatch(text[textPointer])
|
||||
|
||||
patch.Start1, _ = strconv.Atoi(m[1])
|
||||
if len(m[2]) == 0 {
|
||||
patch.Start1--
|
||||
patch.Length1 = 1
|
||||
} else if m[2] == "0" {
|
||||
patch.Length1 = 0
|
||||
} else {
|
||||
patch.Start1--
|
||||
patch.Length1, _ = strconv.Atoi(m[2])
|
||||
}
|
||||
|
||||
patch.Start2, _ = strconv.Atoi(m[3])
|
||||
|
||||
if len(m[4]) == 0 {
|
||||
patch.Start2--
|
||||
patch.Length2 = 1
|
||||
} else if m[4] == "0" {
|
||||
patch.Length2 = 0
|
||||
} else {
|
||||
patch.Start2--
|
||||
patch.Length2, _ = strconv.Atoi(m[4])
|
||||
}
|
||||
textPointer++
|
||||
|
||||
for textPointer < len(text) {
|
||||
if len(text[textPointer]) > 0 {
|
||||
sign = text[textPointer][0]
|
||||
} else {
|
||||
textPointer++
|
||||
continue
|
||||
}
|
||||
|
||||
line = text[textPointer][1:]
|
||||
line = strings.Replace(line, "+", "%2b", -1)
|
||||
line, _ = url.QueryUnescape(line)
|
||||
if sign == '-' {
|
||||
// Deletion.
|
||||
patch.diffs = append(patch.diffs, Diff{DiffDelete, line})
|
||||
} else if sign == '+' {
|
||||
// Insertion.
|
||||
patch.diffs = append(patch.diffs, Diff{DiffInsert, line})
|
||||
} else if sign == ' ' {
|
||||
// Minor equality.
|
||||
patch.diffs = append(patch.diffs, Diff{DiffEqual, line})
|
||||
} else if sign == '@' {
|
||||
// Start of next patch.
|
||||
break
|
||||
} else {
|
||||
// WTF?
|
||||
return patches, errors.New("Invalid patch mode '" + string(sign) + "' in: " + string(line))
|
||||
}
|
||||
textPointer++
|
||||
}
|
||||
|
||||
patches = append(patches, patch)
|
||||
}
|
||||
return patches, nil
|
||||
}
|
190
vendor/github.com/sergi/go-diff/diffmatchpatch/stringutil.go
generated
vendored
Normal file
190
vendor/github.com/sergi/go-diff/diffmatchpatch/stringutil.go
generated
vendored
Normal file
@ -0,0 +1,190 @@
|
||||
// Copyright (c) 2012-2016 The go-diff authors. All rights reserved.
|
||||
// https://github.com/sergi/go-diff
|
||||
// See the included LICENSE file for license details.
|
||||
//
|
||||
// go-diff is a Go implementation of Google's Diff, Match, and Patch library
|
||||
// Original library is Copyright (c) 2006 Google Inc.
|
||||
// http://code.google.com/p/google-diff-match-patch/
|
||||
|
||||
package diffmatchpatch
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
const UNICODE_INVALID_RANGE_START = 0xD800
|
||||
const UNICODE_INVALID_RANGE_END = 0xDFFF
|
||||
const UNICODE_INVALID_RANGE_DELTA = UNICODE_INVALID_RANGE_END - UNICODE_INVALID_RANGE_START + 1
|
||||
const UNICODE_RANGE_MAX = 0x10FFFF
|
||||
|
||||
// unescaper unescapes selected chars for compatibility with JavaScript's encodeURI.
|
||||
// In speed critical applications this could be dropped since the receiving application will certainly decode these fine. Note that this function is case-sensitive. Thus "%3F" would not be unescaped. But this is ok because it is only called with the output of HttpUtility.UrlEncode which returns lowercase hex. Example: "%3f" -> "?", "%24" -> "$", etc.
|
||||
var unescaper = strings.NewReplacer(
|
||||
"%21", "!", "%7E", "~", "%27", "'",
|
||||
"%28", "(", "%29", ")", "%3B", ";",
|
||||
"%2F", "/", "%3F", "?", "%3A", ":",
|
||||
"%40", "@", "%26", "&", "%3D", "=",
|
||||
"%2B", "+", "%24", "$", "%2C", ",", "%23", "#", "%2A", "*")
|
||||
|
||||
// indexOf returns the first index of pattern in str, starting at str[i].
|
||||
func indexOf(str string, pattern string, i int) int {
|
||||
if i > len(str)-1 {
|
||||
return -1
|
||||
}
|
||||
if i <= 0 {
|
||||
return strings.Index(str, pattern)
|
||||
}
|
||||
ind := strings.Index(str[i:], pattern)
|
||||
if ind == -1 {
|
||||
return -1
|
||||
}
|
||||
return ind + i
|
||||
}
|
||||
|
||||
// lastIndexOf returns the last index of pattern in str, starting at str[i].
|
||||
func lastIndexOf(str string, pattern string, i int) int {
|
||||
if i < 0 {
|
||||
return -1
|
||||
}
|
||||
if i >= len(str) {
|
||||
return strings.LastIndex(str, pattern)
|
||||
}
|
||||
_, size := utf8.DecodeRuneInString(str[i:])
|
||||
return strings.LastIndex(str[:i+size], pattern)
|
||||
}
|
||||
|
||||
// runesIndexOf returns the index of pattern in target, starting at target[i].
|
||||
func runesIndexOf(target, pattern []rune, i int) int {
|
||||
if i > len(target)-1 {
|
||||
return -1
|
||||
}
|
||||
if i <= 0 {
|
||||
return runesIndex(target, pattern)
|
||||
}
|
||||
ind := runesIndex(target[i:], pattern)
|
||||
if ind == -1 {
|
||||
return -1
|
||||
}
|
||||
return ind + i
|
||||
}
|
||||
|
||||
func runesEqual(r1, r2 []rune) bool {
|
||||
if len(r1) != len(r2) {
|
||||
return false
|
||||
}
|
||||
for i, c := range r1 {
|
||||
if c != r2[i] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// runesIndex is the equivalent of strings.Index for rune slices.
|
||||
func runesIndex(r1, r2 []rune) int {
|
||||
last := len(r1) - len(r2)
|
||||
for i := 0; i <= last; i++ {
|
||||
if runesEqual(r1[i:i+len(r2)], r2) {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
func intArrayToString(ns []uint32) string {
|
||||
if len(ns) == 0 {
|
||||
return ""
|
||||
}
|
||||
|
||||
b := []rune{}
|
||||
for _, n := range ns {
|
||||
b = append(b, intToRune(n))
|
||||
}
|
||||
return string(b)
|
||||
}
|
||||
|
||||
// These constants define the number of bits representable
|
||||
// in 1,2,3,4 byte utf8 sequences, respectively.
|
||||
const ONE_BYTE_BITS = 7
|
||||
const TWO_BYTE_BITS = 11
|
||||
const THREE_BYTE_BITS = 16
|
||||
const FOUR_BYTE_BITS = 21
|
||||
|
||||
// Helper for getting a sequence of bits from an integer.
|
||||
func getBits(i uint32, cnt byte, from byte) byte {
|
||||
return byte((i >> from) & ((1 << cnt) - 1))
|
||||
}
|
||||
|
||||
// Converts an integer in the range 0~1112060 into a rune.
|
||||
// Based on the ranges table in https://en.wikipedia.org/wiki/UTF-8
|
||||
func intToRune(i uint32) rune {
|
||||
if i < (1 << ONE_BYTE_BITS) {
|
||||
return rune(i)
|
||||
}
|
||||
|
||||
if i < (1 << TWO_BYTE_BITS) {
|
||||
r, size := utf8.DecodeRune([]byte{0b11000000 | getBits(i, 5, 6), 0b10000000 | getBits(i, 6, 0)})
|
||||
if size != 2 || r == utf8.RuneError {
|
||||
panic(fmt.Sprintf("Error encoding an int %d with size 2, got rune %v and size %d", size, r, i))
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
// Last -3 here needed because for some reason 3rd to last codepoint 65533 in this range
|
||||
// was returning utf8.RuneError during encoding.
|
||||
if i < ((1 << THREE_BYTE_BITS) - UNICODE_INVALID_RANGE_DELTA - 3) {
|
||||
if i >= UNICODE_INVALID_RANGE_START {
|
||||
i += UNICODE_INVALID_RANGE_DELTA
|
||||
}
|
||||
|
||||
r, size := utf8.DecodeRune([]byte{0b11100000 | getBits(i, 4, 12), 0b10000000 | getBits(i, 6, 6), 0b10000000 | getBits(i, 6, 0)})
|
||||
if size != 3 || r == utf8.RuneError {
|
||||
panic(fmt.Sprintf("Error encoding an int %d with size 3, got rune %v and size %d", size, r, i))
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
if i < (1<<FOUR_BYTE_BITS - UNICODE_INVALID_RANGE_DELTA - 3) {
|
||||
i += UNICODE_INVALID_RANGE_DELTA + 3
|
||||
r, size := utf8.DecodeRune([]byte{0b11110000 | getBits(i, 3, 18), 0b10000000 | getBits(i, 6, 12), 0b10000000 | getBits(i, 6, 6), 0b10000000 | getBits(i, 6, 0)})
|
||||
if size != 4 || r == utf8.RuneError {
|
||||
panic(fmt.Sprintf("Error encoding an int %d with size 4, got rune %v and size %d", size, r, i))
|
||||
}
|
||||
return r
|
||||
}
|
||||
panic(fmt.Sprintf("The integer %d is too large for runeToInt()", i))
|
||||
}
|
||||
|
||||
// Converts a rune generated by intToRune back to an integer
|
||||
func runeToInt(r rune) uint32 {
|
||||
i := uint32(r)
|
||||
if i < (1 << ONE_BYTE_BITS) {
|
||||
return i
|
||||
}
|
||||
|
||||
bytes := []byte{0, 0, 0, 0}
|
||||
|
||||
size := utf8.EncodeRune(bytes, r)
|
||||
|
||||
if size == 2 {
|
||||
return uint32(bytes[0]&0b11111)<<6 | uint32(bytes[1]&0b111111)
|
||||
}
|
||||
|
||||
if size == 3 {
|
||||
result := uint32(bytes[0]&0b1111)<<12 | uint32(bytes[1]&0b111111)<<6 | uint32(bytes[2]&0b111111)
|
||||
if result >= UNICODE_INVALID_RANGE_END {
|
||||
return result - UNICODE_INVALID_RANGE_DELTA
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
if size == 4 {
|
||||
result := uint32(bytes[0]&0b111)<<18 | uint32(bytes[1]&0b111111)<<12 | uint32(bytes[2]&0b111111)<<6 | uint32(bytes[3]&0b111111)
|
||||
return result - UNICODE_INVALID_RANGE_DELTA - 3
|
||||
}
|
||||
|
||||
panic(fmt.Sprintf("Unexpected state decoding rune=%v size=%d", r, size))
|
||||
}
|
Reference in New Issue
Block a user