reifyhealth / lein-git-down

A Leiningen plugin for resolving dependencies from Git
MIT License
82 stars 6 forks source link

Issue with git repos that start with a number #59

Open abishek opened 1 year ago

abishek commented 1 year ago

I am trying to use this plugin to include clj-pnm as a dependency.

I have this in my :dependencies [28/clj-pnm "c7f635d0e4f163f5eaf9ffd89ffd585a617e15cd"]

When I try to resolve the deps using lein deps, I get the following trace.

java.lang.Exception: Error loading /path/to/project.clj
 at leiningen.core.project$read_raw$fn__8114.invoke (project.clj:1115)
    leiningen.core.project$read_raw.invokeStatic (project.clj:1109)
    leiningen.core.project$read_raw.invoke (project.clj:1105)
    leiningen.core.project$read.invokeStatic (project.clj:1126)
    leiningen.core.project$read.invoke (project.clj:1123)
    leiningen.core.project$read.invokeStatic (project.clj:1127)
    leiningen.core.project$read.invoke (project.clj:1123)
    leiningen.core.main$_main$fn__7469.invoke (main.clj:448)
    leiningen.core.main$_main.invokeStatic (main.clj:442)
    leiningen.core.main$_main.doInvoke (main.clj:439)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.core$apply.invokeStatic (core.clj:667)
    clojure.main$main_opt.invokeStatic (main.clj:514)
    clojure.main$main_opt.invoke (main.clj:510)
    clojure.main$main.invokeStatic (main.clj:664)
    clojure.main$main.doInvoke (main.clj:616)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.main.main (main.java:40)
Caused by: clojure.lang.Compiler$CompilerException: Syntax error reading source at (/path/to/project.clj:11:29).
#:clojure.error{:phase :read-source, :line 11, :column 29, :source "/path/to/project.clj"}
 at clojure.lang.Compiler.load (Compiler.java:7660)
    clojure.lang.Compiler.loadFile (Compiler.java:7591)
    clojure.lang.RT$3.invoke (RT.java:327)
    leiningen.core.project$read_raw$fn__8114.invoke (project.clj:1113)
    leiningen.core.project$read_raw.invokeStatic (project.clj:1109)
    leiningen.core.project$read_raw.invoke (project.clj:1105)
    leiningen.core.project$read.invokeStatic (project.clj:1126)
    leiningen.core.project$read.invoke (project.clj:1123)
    leiningen.core.project$read.invokeStatic (project.clj:1127)
    leiningen.core.project$read.invoke (project.clj:1123)
    leiningen.core.main$_main$fn__7469.invoke (main.clj:448)
    leiningen.core.main$_main.invokeStatic (main.clj:442)
    leiningen.core.main$_main.doInvoke (main.clj:439)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.core$apply.invokeStatic (core.clj:667)
    clojure.main$main_opt.invokeStatic (main.clj:514)
    clojure.main$main_opt.invoke (main.clj:510)
    clojure.main$main.invokeStatic (main.clj:664)
    clojure.main$main.doInvoke (main.clj:616)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.main.main (main.java:40)
Caused by: java.lang.NumberFormatException: Invalid number: 28/clj-pnm
 at clojure.lang.LispReader.readNumber (LispReader.java:352)
    clojure.lang.LispReader.read (LispReader.java:278)
    clojure.lang.LispReader.readDelimitedList (LispReader.java:1398)
    clojure.lang.LispReader$VectorReader.invoke (LispReader.java:1347)
    clojure.lang.LispReader.read (LispReader.java:285)
    clojure.lang.LispReader.readDelimitedList (LispReader.java:1398)
    clojure.lang.LispReader$VectorReader.invoke (LispReader.java:1347)
    clojure.lang.LispReader.read (LispReader.java:285)
    clojure.lang.LispReader.readDelimitedList (LispReader.java:1398)
    clojure.lang.LispReader$ListReader.invoke (LispReader.java:1243)
    clojure.lang.LispReader.read (LispReader.java:285)
    clojure.lang.LispReader.read (LispReader.java:216)
    clojure.lang.Compiler.load (Compiler.java:7647)
    clojure.lang.Compiler.loadFile (Compiler.java:7591)
    clojure.lang.RT$3.invoke (RT.java:327)
    leiningen.core.project$read_raw$fn__8114.invoke (project.clj:1113)
    leiningen.core.project$read_raw.invokeStatic (project.clj:1109)
    leiningen.core.project$read_raw.invoke (project.clj:1105)
    leiningen.core.project$read.invokeStatic (project.clj:1126)
    leiningen.core.project$read.invoke (project.clj:1123)
    leiningen.core.project$read.invokeStatic (project.clj:1127)
    leiningen.core.project$read.invoke (project.clj:1123)
    leiningen.core.main$_main$fn__7469.invoke (main.clj:448)
    leiningen.core.main$_main.invokeStatic (main.clj:442)
    leiningen.core.main$_main.doInvoke (main.clj:439)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.core$apply.invokeStatic (core.clj:667)
    clojure.main$main_opt.invokeStatic (main.clj:514)
    clojure.main$main_opt.invoke (main.clj:510)
    clojure.main$main.invokeStatic (main.clj:664)
    clojure.main$main.doInvoke (main.clj:616)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.main.main (main.java:40)

If I replace the dependency to use my fork, it works fine. [abishek/clj-pnm "c7f635d0e4f163f5eaf9ffd89ffd585a617e15cd"]

Should I do something different? I don't intend to maintain this project, so I'd rather not fork it and miss any updates. Thanks!

rome-user commented 1 year ago

Hi. This error happens because Clojure's syntax reader disallows symbol literals starting with a number. However, you can still use 28 as a namespace if you evaluate (symbol "28" "clj-pnm"). You should be able to evaluate this inside the defproject form as follows.

(defproject example-project "version"
  ;; elided
  :dependencies [[#=(symbol "28" "clj-pnm") "c7f635d0e4f163f5eaf9ffd89ffd585a617e15cd"]])