ArchGDAL, getfeature() error

hotspot_path = "zoneforhotspot.geojson"
d = ArchGDAL.read(hotspot_path)
layer = ArchGDAL.getlayer(d, 0)
fs = ArchGDAL.getfeature(layer, 1) do f
      ArchGDAL.getgeom(f)  
end
fs
d = ArchGDAL.read(hotspot_path)
layer = ArchGDAL.getlayer(d, 0)

f = ArchGDAL.getfeature(layer, 1)  # error here
fs = ArchGDAL.getgeom(f)

There is error if I do not use do block.
The error message is as following.

MethodError: no method matching getfeature(::ArchGDAL.IFeatureLayer, ::Int64)
Closest candidates are:
  getfeature(!Matched::Function, ::Any...; kwargs...) at /home/liye/.julia/packages/ArchGDAL/ohMpc/src/context.jl:213

Stacktrace:
 [1] top-level scope at In[52]:3

Can anyone tell the reason of the error?

To me it appears that getfeature requires a function as it’s first parameter. That is what:

fs = ArchGDAL.getfeature(layer, 1) do f
      ArchGDAL.getgeom(f)  
end

is doing. It creates a small function that calls ArchGDAL.getgeom(f) and passes it in as the first parameter to the method. Later when you do f = ArchGDAL.getfeature(layer, 1) there is no function being passed in.

It exactly acts as you said. Thank you so much!
https://docs.julialang.org/en/v1/manual/functions/#Do-Block-Syntax-for-Function-Arguments-1

# 1 method for generic function "getfeature":
[1] getfeature(f::Function, args...; kwargs...) in ArchGDAL at /home/liye/.julia/packages/ArchGDAL/ohMpc/src/context.jl:213