-
Notifications
You must be signed in to change notification settings - Fork 2
Closed
Labels
Description
There should be exactly one JVM resource backing a given clj/s ns. Else its source would be ambiguous, leading to hard-to-debug errors. Normally these are caused by 'dirty' libraries or an incorrect project.clj configuration.
I developed the following snippet which could serve as a base for a linter against that:
(defn resources
([n]
(resources n (.getContextClassLoader (Thread/currentThread))))
([n ^ClassLoader loader]
(.getResources loader n)))
(->> "clojure/core/specs/alpha.clj"
resources
enumeration-seq
(map str)
(clojure.pprint/pprint))
;; the above results in:
'("jar:file:/Users/vemv/.m2/repository/clojure-future-spec/clojure-future-spec/1.9.0-beta4/clojure-future-spec-1.9.0-beta4.jar!/clojure/core/specs/alpha.clj"
"jar:file:/Users/vemv/.m2/repository/org/clojure/core.specs.alpha/0.2.44/core.specs.alpha-0.2.44.jar!/clojure/core/specs/alpha.clj")