Fork me on GitHub

I'm having trouble deciding on a linter to use. Ideally I want the linter to be compatible with Intellij + cursive and vim environment, and my plan is to make an on commit check that runs the linter with GitHub actions. Any help would be great!


@U05254DQM I saw this clj-kondo, is it a good linter for running a commit check / GitHub actions and have you see any example repos that have it implemented as a github action?


clj-kondo is far and away the most sophisticated and best supported linter for Clojure these days.

👍 9
clj-kondo 3

Check out the #clj-kondo channel if you have any questions @kevin26428

Jelle Licht13:09:41

I have a (gen-class :name proj.translator.MyClass ...) in ns proj.translator . In proj.core, I refer to proj.translator.MyClass , which works fine in 'interactive use' (where :aot proj.translator is the only entry). When I run lein uberjar, I also set :aot :all , which leads to proj.core being compiled as well; it is at this point that lein complains with a ClassNotFoundException that proj.translator.MyClass is not found (as it hasn't been compiled yet). Is there anything I can do to make this work? Perhaps some import/require statement?

Jelle Licht14:09:42

it seems that compilation happens in alphabetical order, which is clearly not what I want. Is my only practical option to rename proj.translator to proj.aaaaaatranslator ? It works, but feels ridiculous 😕


If your proj.core ns requires your proj.translator ns then it should get AOT'd in the correct order.


(because AOT is transitive)

👍 3
Mark Wardle20:09:10

Hi! Does anyone have an easy way of injecting git commit info (e.g. result of ‘git rev-parse --short HEAD’) into a deps.edn build? I have found for leiningen. Thanks!

Alex Miller (Clojure team)20:09:11

I do, but it's not public yet :)

👍 6
Mark Wardle20:09:53

Thank you. Good to know!


How to restart a component, for example responsive for db pooling or amqp/kafka connections, when connection goes down for a few seconds? Im referring to Stuart Sierra Component


Usually a component will wrap something like a connection pool, not a single connection


And the connection pool creates new connections as required, so you don't restart the component


Hello all, I have this

(def active (atom true))

  (-> (proxy [Thread] []
        (run []
          (while @active
            (println "Loop")
             (Thread/sleep 1000))))
to stop it, I have to (reset! active false) Is there any way to control running process instead of using external atom?


Using future-cancel

(def work (future (while (not (Thread/interrupted))
                    (println [(new java.util.Date) (reduce + (range 1e8))]))))
=> #'user/work
[#inst "2020-09-27T14:31:42.790-00:00" 4999999950000000]
[#inst "2020-09-27T14:31:44.070-00:00" 4999999950000000]
    (future-cancel work)
=> true
[#inst "2020-09-27T14:31:45.271-00:00" 4999999950000000]


But use future, or just pass function to thread's constructor (they are runnable)


@hiredman do you think it´s better using future with future-cancel ?


using an atom is best


is not that ugly way using atom?


you are using state shared between threads


you say that you can stop all thread once?


don't def a global of course


so, how to use it from inside proxy?


a. don't use proxy, as I said b. proxy, reify, fns, etc will close over locals


(let [stop? (atom false)] (future (while (not @stop) ...)) ... (reset! stop? true)) 


missed some parens


ok, sure, understood