Fork me on GitHub
AJ Jaro15:08:46

I’m just starting to get into clj-kondo and really like it so far! Is it possible that clj-kondo can resolve function names that a macro produces? For example, I have a macro create-utils that generates a set of standard functions like save! and for-id. I tried using the macroexpand utility and I couldn’t get that to work, but I’m not sure if this behavior is possible to resolve with clj-kondo. Could I reference save! or for-id from another namespace and have it resolve successfully? Example:

(ns db.core
 (:require [db.util :as util])

(ns db.test
 (:require [db.core :as core])

(defn get-data []
  (core/for-id 1))


@ajarosinski example seems incomplete?

👍 3
AJ Jaro15:08:00

I accidentally hit the wrong enter button!! In the example above, I am having trouble resolving for-id in db.test


what you can do here is use the macroexpand feature to expand into (do (def for-id ..) )


or just (declare for-id ...)

AJ Jaro15:08:35

Hmm, ok. I will give it another go! Thanks @borkdude


Let me know when you get stuck, I'm 100% sure this can work :)


In doubt, stick a println in your macro to see if it gets executed


and execute clj-kondo from the command line

AJ Jaro15:08:24

That’s the confirmation I needed before I spent a ton of time on it. I really appreciate your support in this channel; it’s downright impressive

AJ Jaro20:08:27

Welp, it of course turns out to be user error. It helps a lot of I upgrade to the proper version! :face_palm:


ah yes, it's a new feature :)


Perhaps we should add that to the docs

AJ Jaro20:08:52

Meh, I don't know. I definitely knew it was a new feature. Just silliness