Let $B$ be a real or complex Banach space, and let $B^*$ be its dual space.That is, $B^*$ is the space of continuous linear functionals $g:B\to S$ (where $S$ is $ R$ for real space $X$ ,and $ S$ is $ C$ for complex space $X$)......For $g\in B^*$ we define $||g||=\sup \{|g(x)|/||x|| :x \ne 0\}$ . Now let $ M_g=\{x\in X: g(x)=0\}$.It is an easy exercise to show that $$(1)... \forall x \in X (|g(x)|=||g||.d(x,M_g))$$ and $$(2)... g\ne 0 \implies \forall x\in X (g(x)\ne 0\implies X=\{s x +y : s\in S\wedge y\in M_g\}.$$Now for $g\neq 0$ we say that $ g$ attains its norm iff $$(3)...\exists x (|g(x)|=||g||.||x||\ne 0).$$ Obviously $g$ attains its norm iff $\exists x (||x||=1\wedge |g(x)|=||g||\ne 0).$ And for $ x\in X$ we say that $x$ attains its distance to $ M_g$ iff $$(4)...\exists y\in M_g (||x-y||=d(x,M_g).$$Now from (1) and (2) we can easily prove : For any $g\in B^*$ with $ g\ne 0 $, $$g\text{ attains its norm }\iff$$ $$\forall x\in X (x \text{ attains its distance to } M_g) \iff$$ $$\exists x\in X \backslash M_g (x \text{ attains its distance to } M_g) .$$ In your Q, we have $g(f)=\int_0^1 f $ .So prove that $||g||=1$. (To show $||g||\geq 1$,consider $f(x)=\min (x,1/n)$ for $ n\in N$.) Then show that ($g(f)\ne 0\implies |g(f)|<||f||$).(Consider that for $f\ne 0$ there exists $d>0$ such that $x\in [0,d]\implies |f(x)|<||f||/2 $ .) Hence $$g \text { does not attain its norm.}$$ Hence by (1) $$(||f||=1\wedge g(f)\ne 0)\implies 1=||g||.||f||>|g(f)=||g||d(f,M_g)=d(f,M_g).$$ Furthermore by (4),we have $$g(f)\ne 0\implies \forall m\in M_g (||f-m||>d(f,M_g).$$ So for an example we may take any $f\in X$ for which $||f||=1$ and $\int_0^1f\ne 0$ . For instance $f(x)=x$ for $x\in [0,1]$.