forked from mitchellh/mapstructure
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: backport comparable check to <1.20
Signed-off-by: Mark Sagi-Kazar <[email protected]>
- Loading branch information
1 parent
58a4c3b
commit 379c776
Showing
23 changed files
with
237 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/nix/store/7k68a83zyk7wzkjaa5kplgjqsyi4wpwd-devenv-profile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
if [[ ! -d "/Users/mark/Projects/viper/mapstructure" ]]; then | ||
echo "Cannot find source directory; Did you move it?" | ||
echo "(Looking for "/Users/mark/Projects/viper/mapstructure")" | ||
echo 'Cannot force reload with this script - use "direnv reload" manually and then try again' | ||
exit 1 | ||
fi | ||
|
||
# rebuild the cache forcefully | ||
_nix_direnv_force_reload=1 direnv exec "/Users/mark/Projects/viper/mapstructure" true | ||
|
||
# Update the mtime for .envrc. | ||
# This will cause direnv to reload again - but without re-building. | ||
touch "/Users/mark/Projects/viper/mapstructure/.envrc" | ||
|
||
# Also update the timestamp of whatever profile_rc we have. | ||
# This makes sure that we know we are up to date. | ||
touch -r "/Users/mark/Projects/viper/mapstructure/.envrc" "/Users/mark/Projects/viper/mapstructure/.direnv"/*.rc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/nix/store/027wnc7kfpdl7n7xr7pby8csjd31d8xw-source |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/nix/store/2gkqfvzq2j0vbrlkx3y0k8qxyn4px989-source |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/nix/store/4yg9rk38xim0166ynim8ndxvh6qi4pcc-source |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/nix/store/88fpp9lrbs0vk8yf94bz045y3bfz7m2r-source |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/nix/store/8sm7wycza5fl6lnsmw11sn4vqkvw4xyh-source |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/nix/store/a6m3cymd6cw5kz3zw6hxamd7cnb6mvjy-source |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/nix/store/cjvwy2rr87ir1nb6wvs9n6lvbnzlqrdg-source |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/nix/store/d334lhlj2amjdpl3np78lalp2f8c4d5c-source |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/nix/store/d50vypw46l5rmmgz16hzg5r5r268ak2n-source |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/nix/store/isia7synl0mdbcvfwav5ywnrwmwbwvxv-source |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/nix/store/qjw6nq34h4s78573nh70gsl2a2qz76mz-source |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/nix/store/r2ip1850igy8kciyaagw502s3c6ph1s4-source |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/nix/store/xkci0s3glinkrb3prpz0ah6b8fg51504-source |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/nix/store/yj1wxm9hh8610iyzqnz75kvs6xl8j3my-source |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/nix/store/yxld2qw84ka591fay1xkh5jflbgxjqa1-source |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/nix/store/3g2mvqm72zsf7rsaffzf0snsl15b7b7m-devenv-shell-env |
180 changes: 180 additions & 0 deletions
180
.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa.rc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,180 @@ | ||
unset shellHook | ||
PATH=${PATH:-} | ||
nix_saved_PATH="$PATH" | ||
XDG_DATA_DIRS=${XDG_DATA_DIRS:-} | ||
nix_saved_XDG_DATA_DIRS="$XDG_DATA_DIRS" | ||
BASH='/nix/store/8rxm4jzw1dddm53rpc2zdqgafadn7d5n-bash-interactive-5.2-p21/bin/bash' | ||
HOSTTYPE='aarch64' | ||
IFS=' | ||
' | ||
IN_NIX_SHELL='impure' | ||
export IN_NIX_SHELL | ||
LINENO='76' | ||
MACHTYPE='aarch64-apple-darwin22.6.0' | ||
NIX_BUILD_CORES='0' | ||
export NIX_BUILD_CORES | ||
NIX_STORE='/nix/store' | ||
export NIX_STORE | ||
OLDPWD='' | ||
export OLDPWD | ||
OPTERR='1' | ||
OSTYPE='darwin22.6.0' | ||
PATH='/path-not-set' | ||
export PATH | ||
PS4='+ ' | ||
builder='/nix/store/8rxm4jzw1dddm53rpc2zdqgafadn7d5n-bash-interactive-5.2-p21/bin/bash' | ||
export builder | ||
dontAddDisableDepTrack='1' | ||
export dontAddDisableDepTrack | ||
name='devenv-shell-env' | ||
export name | ||
out='/Users/mark/Projects/viper/mapstructure/outputs/out' | ||
export out | ||
outputs='out' | ||
shellHook=' | ||
# Remove all the unnecessary noise that is set by the build env | ||
unset NIX_BUILD_TOP NIX_BUILD_CORES NIX_STORE | ||
unset TEMP TEMPDIR TMP | ||
# $name variable is preserved to keep it compatible with pure shell https://github.com/sindresorhus/pure/blob/47c0c881f0e7cfdb5eaccd335f52ad17b897c060/pure.zsh#L235 | ||
unset builder out shellHook stdenv system | ||
# Flakes stuff | ||
unset dontAddDisableDepTrack outputs | ||
|
||
# For `nix develop`. We get /noshell on Linux and /sbin/nologin on macOS. | ||
if [[ "$SHELL" == "/noshell" || "$SHELL" == "/sbin/nologin" ]]; then | ||
export SHELL=/nix/store/8rxm4jzw1dddm53rpc2zdqgafadn7d5n-bash-interactive-5.2-p21/bin/bash | ||
fi | ||
|
||
# https://github.com/numtide/devshell/issues/158 | ||
PATH=${PATH#/path-not-set:} | ||
|
||
export DEVENV_PROFILE=/nix/store/7k68a83zyk7wzkjaa5kplgjqsyi4wpwd-devenv-profile | ||
|
||
# add installed packages to PATH | ||
export PATH="$DEVENV_PROFILE/bin:$PATH" | ||
|
||
# prepend common compilation lookup paths | ||
export PKG_CONFIG_PATH="$DEVENV_PROFILE/lib/pkgconfig:${PKG_CONFIG_PATH-}" | ||
export LD_LIBRARY_PATH="$DEVENV_PROFILE/lib:${LD_LIBRARY_PATH-}" | ||
export LIBRARY_PATH="$DEVENV_PROFILE/lib:${LIBRARY_PATH-}" | ||
export C_INCLUDE_PATH="$DEVENV_PROFILE/include:${C_INCLUDE_PATH-}" | ||
|
||
# these provide shell completions / default config options | ||
export XDG_DATA_DIRS="$DEVENV_PROFILE/share:${XDG_DATA_DIRS-}" | ||
export XDG_CONFIG_DIRS="$DEVENV_PROFILE/etc/xdg:${XDG_CONFIG_DIRS-}" | ||
|
||
export DEVENV_DOTFILE='\''/Users/mark/Projects/viper/mapstructure/.devenv'\'' | ||
export DEVENV_PROFILE='\''/nix/store/7k68a83zyk7wzkjaa5kplgjqsyi4wpwd-devenv-profile'\'' | ||
export DEVENV_ROOT='\''/Users/mark/Projects/viper/mapstructure'\'' | ||
export DEVENV_STATE='\''/Users/mark/Projects/viper/mapstructure/.devenv/state'\'' | ||
export GOPATH='\''/Users/mark/Projects/viper/mapstructure/.devenv/state/go'\'' | ||
export GOROOT='\''/nix/store/b0rpa34hn6cgbkbn8sfr5dzv723ia3z2-go-1.21.5/share/go/'\'' | ||
|
||
export PATH=/nix/store/zf05xsah3wfzcsb667ncxlj7xkgjpi20-pre-commit-3.3.3/bin:$PATH | ||
if ! type -t git >/dev/null; then | ||
# This happens in pure shells, including lorri | ||
echo 1>&2 "WARNING: pre-commit-hooks.nix: git command not found; skipping installation." | ||
elif ! /nix/store/q7avibx4c00h7zl3jfh3r5mc4xs6wsnj-git-2.42.0/bin/git rev-parse --git-dir &> /dev/null; then | ||
echo 1>&2 "WARNING: pre-commit-hooks.nix: .git not found; skipping installation." | ||
else | ||
GIT_WC=`/nix/store/q7avibx4c00h7zl3jfh3r5mc4xs6wsnj-git-2.42.0/bin/git rev-parse --show-toplevel` | ||
|
||
# These update procedures compare before they write, to avoid | ||
# filesystem churn. This improves performance with watch tools like lorri | ||
# and prevents installation loops by via lorri. | ||
|
||
if readlink "${GIT_WC}/.pre-commit-config.yaml" >/dev/null \ | ||
&& [[ $(readlink "${GIT_WC}/.pre-commit-config.yaml") == /nix/store/3ws5xna2njkw8s4l002r5w80jrgq1wl9-pre-commit-config.json ]]; then | ||
echo 1>&2 "pre-commit-hooks.nix: hooks up to date" | ||
else | ||
echo 1>&2 "pre-commit-hooks.nix: updating $PWD repo" | ||
|
||
[ -L .pre-commit-config.yaml ] && unlink .pre-commit-config.yaml | ||
|
||
if [ -e "${GIT_WC}/.pre-commit-config.yaml" ]; then | ||
echo 1>&2 "pre-commit-hooks.nix: WARNING: Refusing to install because of pre-existing .pre-commit-config.yaml" | ||
echo 1>&2 " 1. Translate .pre-commit-config.yaml contents to the new syntax in your Nix file" | ||
echo 1>&2 " see https://github.com/cachix/pre-commit-hooks.nix#getting-started" | ||
echo 1>&2 " 2. remove .pre-commit-config.yaml" | ||
echo 1>&2 " 3. add .pre-commit-config.yaml to .gitignore" | ||
else | ||
ln -fs /nix/store/3ws5xna2njkw8s4l002r5w80jrgq1wl9-pre-commit-config.json "${GIT_WC}/.pre-commit-config.yaml" | ||
# Remove any previously installed hooks (since pre-commit itself has no convergent design) | ||
hooks="pre-commit pre-merge-commit pre-push prepare-commit-msg commit-msg post-checkout post-commit" | ||
for hook in $hooks; do | ||
pre-commit uninstall -t $hook | ||
done | ||
/nix/store/q7avibx4c00h7zl3jfh3r5mc4xs6wsnj-git-2.42.0/bin/git config --local core.hooksPath "" | ||
# Add hooks for configured stages (only) ... | ||
if [ ! -z "commit" ]; then | ||
for stage in commit; do | ||
if [[ "$stage" == "manual" ]]; then | ||
continue | ||
fi | ||
case $stage in | ||
# if you amend these switches please also review $hooks above | ||
commit | merge-commit | push) | ||
stage="pre-"$stage | ||
pre-commit install -t $stage | ||
;; | ||
prepare-commit-msg | commit-msg | post-checkout | post-commit) | ||
pre-commit install -t $stage | ||
;; | ||
*) | ||
echo 1>&2 "ERROR: pre-commit-hooks.nix: either $stage is not a valid stage or pre-commit-hooks.nix doesn'\''t yet support it." | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
# ... or default '\''pre-commit'\'' hook | ||
else | ||
pre-commit install | ||
fi | ||
/nix/store/q7avibx4c00h7zl3jfh3r5mc4xs6wsnj-git-2.42.0/bin/git config --local core.hooksPath "$(/nix/store/q7avibx4c00h7zl3jfh3r5mc4xs6wsnj-git-2.42.0/bin/git rev-parse --git-common-dir)/hooks" | ||
fi | ||
fi | ||
fi | ||
|
||
|
||
export PATH=$GOPATH/bin:$PATH | ||
|
||
export PS1="\[\e[0;34m\](devenv)\[\e[0m\] ${PS1-}" | ||
|
||
# set path to locales on non-NixOS Linux hosts | ||
|
||
|
||
# note what environments are active, but make sure we don'\''t repeat them | ||
if [[ ! "${DIRENV_ACTIVE-}" =~ (^|:)"$PWD"(:|$) ]]; then | ||
export DIRENV_ACTIVE="$PWD:${DIRENV_ACTIVE-}" | ||
fi | ||
|
||
# devenv helper | ||
if [ ! type -p direnv &>/dev/null && -f .envrc ]; then | ||
echo "You have .envrc but direnv command is not installed." | ||
echo "Please install direnv: https://direnv.net/docs/installation.html" | ||
fi | ||
|
||
mkdir -p .devenv | ||
rm -f .devenv/profile | ||
ln -s /nix/store/7k68a83zyk7wzkjaa5kplgjqsyi4wpwd-devenv-profile .devenv/profile | ||
|
||
' | ||
export shellHook | ||
stdenv='/nix/store/4dmdxaw0gzx9ns4n60kczbhsm0qlq3zz-naked-stdenv' | ||
export stdenv | ||
system='aarch64-darwin' | ||
export system | ||
runHook () | ||
{ | ||
|
||
eval "$shellHook"; | ||
unset runHook | ||
} | ||
PATH="$PATH${nix_saved_PATH:+:$nix_saved_PATH}" | ||
XDG_DATA_DIRS="$XDG_DATA_DIRS${nix_saved_XDG_DATA_DIRS:+:$nix_saved_XDG_DATA_DIRS}" | ||
export NIX_BUILD_TOP="$(mktemp -d -t nix-shell.XXXXXX)" | ||
export TMP="$NIX_BUILD_TOP" | ||
export TMPDIR="$NIX_BUILD_TOP" | ||
export TEMP="$NIX_BUILD_TOP" | ||
export TEMPDIR="$NIX_BUILD_TOP" | ||
eval "$shellHook" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/nix/store/3ws5xna2njkw8s4l002r5w80jrgq1wl9-pre-commit-config.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//go:build !go1.20 | ||
|
||
package mapstructure | ||
|
||
import "reflect" | ||
|
||
func isComparable(v reflect.Value) bool { | ||
return false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
//go:build go1.20 | ||
|
||
package mapstructure | ||
|
||
import "reflect" | ||
|
||
// TODO: remove once we drop support for Go <1.20 | ||
func isComparable(v reflect.Value) bool { | ||
return v.Comparable() | ||
} |